Skip to content

Commit df406fd

Browse files
harringtondChromium LUCI CQ
authored andcommitted
Enable some pinned tab tests for multi-instance
Bug: b:448448098 Change-Id: I6a6a6964ba88487440ff49ec49c4b0644dba66b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7050702 Reviewed-by: Bryant Chandler <[email protected]> Commit-Queue: Dan Harrington <[email protected]> Cr-Commit-Position: refs/heads/main@{#1532368}
1 parent 0ec94d1 commit df406fd

File tree

3 files changed

+37
-26
lines changed

3 files changed

+37
-26
lines changed

chrome/browser/glic/host/glic_api_browsertest.cc

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,24 +1906,24 @@ IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
19061906
ExecuteJsTest();
19071907
}
19081908

1909-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
1909+
IN_PROC_BROWSER_TEST_P(GlicApiTest,
19101910
testPinTabsStatePersistWhenClosePanelAndReopen) {
19111911
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
1912+
NavigateTabAndOpenGlicFloating();
19121913
const int tab_id =
19131914
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
19141915
RunTestSequence(AddInstrumentedTab(kSecondTab, page_url()));
19151916

19161917
ExecuteJsTest({.params = base::Value(base::Value::Dict().Set(
19171918
"tabId", base::NumberToString(tab_id)))});
19181919

1919-
RunTestSequence(OpenGlicWindow(GlicWindowMode::kDetached,
1920-
GlicInstrumentMode::kHostAndContents));
1920+
RunTestSequence(OpenGlicFloatingWindow());
19211921
ContinueJsTest();
19221922
}
19231923

1924-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
1925-
testPinTabsStatePersistWhenClientRestarts) {
1924+
IN_PROC_BROWSER_TEST_P(GlicApiTest, testPinTabsStatePersistWhenClientRestarts) {
19261925
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
1926+
NavigateTabAndOpenGlicFloating();
19271927
const int tab_id =
19281928
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
19291929
RunTestSequence(AddInstrumentedTab(kSecondTab, page_url()));
@@ -1944,8 +1944,7 @@ IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
19441944
IN_PROC_BROWSER_TEST_P(GlicApiTest, testPinTabsFailsWhenIncognitoWindow) {
19451945
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
19461946
browser_activator().SetMode(BrowserActivator::Mode::kFirst);
1947-
RunTestSequence(OpenGlicWindow(GlicWindowMode::kDetached,
1948-
GlicInstrumentMode::kHostAndContents));
1947+
NavigateTabAndOpenGlicFloating();
19491948

19501949
// Open a new incognito window.
19511950
auto* incognito = CreateIncognitoBrowser();
@@ -1961,8 +1960,10 @@ IN_PROC_BROWSER_TEST_P(GlicApiTest, testPinTabsFailsWhenIncognitoWindow) {
19611960
"incognitoTabId", base::NumberToString(incognito_tab_id)))});
19621961
}
19631962

1964-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab, testUnpinTabsFailsWhenNotPinned) {
1965-
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
1963+
IN_PROC_BROWSER_TEST_P(GlicApiTest, testUnpinTabsFailsWhenNotPinned) {
1964+
// TODO(bryantchandler): This segfauts on multi-instance. Fix and re-enable.
1965+
SKIP_TEST_FOR_MULTI_INSTANCE();
1966+
NavigateTabAndOpenGlicFloating();
19661967
// Unpinning a tab that is not pinned should fail.
19671968
const int tab_id =
19681969
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
@@ -1972,8 +1973,10 @@ IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab, testUnpinTabsFailsWhenNotPinned) {
19721973
"tabId", base::NumberToString(tab_id)))});
19731974
}
19741975

1975-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab, testUnpinAllTabs) {
1976-
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
1976+
IN_PROC_BROWSER_TEST_P(GlicApiTest, testUnpinAllTabs) {
1977+
// TODO(bryantchandler): This has a UAF on multi-instance. Fix and re-enable.
1978+
SKIP_TEST_FOR_MULTI_INSTANCE();
1979+
NavigateTabAndOpenGlicFloating();
19771980
const int tab_id =
19781981
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
19791982
RunTestSequence(AddInstrumentedTab(kSecondTab, page_url()));
@@ -1984,7 +1987,8 @@ IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab, testUnpinAllTabs) {
19841987

19851988
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
19861989
testPinTabsHaveNoEffectOnFocusedTab) {
1987-
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
1990+
// In multi-instance, pinned tabs do have an effect on the focused tab.
1991+
SKIP_TEST_FOR_MULTI_INSTANCE();
19881992
const int tab_id =
19891993
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
19901994
RunTestSequence(AddInstrumentedTab(kSecondTab, page_url()));
@@ -2028,9 +2032,8 @@ IN_PROC_BROWSER_TEST_P(GlicApiTest, testUnpinTabsThatNavigateInBackground) {
20282032
ContinueJsTest();
20292033
}
20302034

2031-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
2032-
testTabDataUpdateOnUrlChangeForPinnedTab) {
2033-
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
2035+
IN_PROC_BROWSER_TEST_P(GlicApiTest, testTabDataUpdateOnUrlChangeForPinnedTab) {
2036+
NavigateTabAndOpenGlicFloating();
20342037
const int tab_id =
20352038
GetTabId(browser()->tab_strip_model()->GetActiveWebContents());
20362039
RunTestSequence(AddInstrumentedTab(kSecondTab, page_url()));
@@ -2046,9 +2049,9 @@ IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
20462049
ContinueJsTest();
20472050
}
20482051

2049-
IN_PROC_BROWSER_TEST_P(GlicApiTestWithOneTab,
2052+
IN_PROC_BROWSER_TEST_P(GlicApiTest,
20502053
testTabDataUpdateOnFaviconChangeForPinnedTab) {
2051-
TODO_SKIP_BROKEN_MULTI_INSTANCE_TEST();
2054+
NavigateTabAndOpenGlicFloating();
20522055
content::WebContents* web_contents =
20532056
browser()->tab_strip_model()->GetActiveWebContents();
20542057
ASSERT_TRUE(web_contents);

chrome/browser/glic/test_support/interactive_glic_test.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,16 @@ template <typename T>
7777
class InteractiveGlicTestMixin : public T {
7878
public:
7979
// Determines whether this is an attached or detached Glic window.
80+
// WARNING: This is no longer very meaningful, and should be replaced. These
81+
// do not provide the ability to open glic as a floating window when in
82+
// multi-instance mode. See the comments just below.
8083
enum GlicWindowMode {
84+
// Opens glic by pressing the Glic button on the browser.
85+
// In multi-instance, this means it will open glic as a side panel.
86+
// Otherwise, glic is opened as a floating window.
8187
kAttached,
88+
// Opens glic by calling ShowDetachedForTesting() on the window controller.
89+
// There may not be a good reason for using this.
8290
kDetached,
8391
};
8492

chrome/test/data/webui/glic/browser_tests/glic_api_browsertest.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,9 +1167,9 @@ class ApiTests extends ApiTestFixtureBase {
11671167
assertDefined(this.host.getPinnedTabs);
11681168

11691169
const tabId = this.testParams.tabId;
1170-
const focusedTabId = this.getFocusedTabId();
1170+
const activeTabId = this.getActiveTabId();
11711171

1172-
assertTrue(await this.host.pinTabs([focusedTabId, tabId]));
1172+
assertTrue(await this.host.pinTabs([activeTabId, tabId]));
11731173
const pinnedTabsUpdates = observeSequence(this.host.getPinnedTabs());
11741174
await pinnedTabsUpdates.waitFor((tabs) => tabs.length === 2);
11751175

@@ -1189,9 +1189,9 @@ class ApiTests extends ApiTestFixtureBase {
11891189
assertDefined(this.host.getPinnedTabs);
11901190

11911191
const tabId = this.testParams.tabId;
1192-
const focusedTabId = this.getFocusedTabId();
1192+
const activeTabId = this.getActiveTabId();
11931193

1194-
assertTrue(await this.host.pinTabs([focusedTabId, tabId]));
1194+
assertTrue(await this.host.pinTabs([activeTabId, tabId]));
11951195
const pinnedTabsUpdates = observeSequence(this.host.getPinnedTabs());
11961196
await pinnedTabsUpdates.waitFor((tabs) => tabs.length === 2);
11971197
} else {
@@ -1215,7 +1215,7 @@ class ApiTests extends ApiTestFixtureBase {
12151215
assertDefined(this.host.unpinTabs);
12161216

12171217
const tabId = this.testParams.tabId;
1218-
const tabId2 = this.getFocusedTabId();
1218+
const tabId2 = this.getActiveTabId();
12191219
// Pin both tabs.
12201220
assertTrue(await this.host.pinTabs([tabId2, tabId]));
12211221

@@ -1237,7 +1237,7 @@ class ApiTests extends ApiTestFixtureBase {
12371237
assertDefined(this.host.unpinAllTabs);
12381238

12391239
const tabId = this.testParams.tabId;
1240-
const tabId2 = this.getFocusedTabId();
1240+
const tabId2 = this.getActiveTabId();
12411241

12421242
// Pin both tabs.
12431243
assertTrue(await this.host.pinTabs([tabId2, tabId]));
@@ -1313,7 +1313,7 @@ class ApiTests extends ApiTestFixtureBase {
13131313
assertDefined(this.host.pinTabs);
13141314

13151315
const tabId = this.testParams.tabId;
1316-
assertNotEquals(tabId, this.getFocusedTabId());
1316+
assertNotEquals(tabId, this.getActiveTabId());
13171317

13181318
await this.host.pinTabs([tabId]);
13191319
const pinnedTabsUpdates = observeSequence(this.host.getPinnedTabs());
@@ -1324,7 +1324,7 @@ class ApiTests extends ApiTestFixtureBase {
13241324
await this.advanceToNextStep();
13251325

13261326
// Make sure that the pinned tab is not focused.
1327-
assertNotEquals(tabId, this.getFocusedTabId());
1327+
assertNotEquals(tabId, this.getActiveTabId());
13281328
await pinnedTabsUpdates.waitFor(
13291329
(tabs) =>
13301330
tabs.some(t => t.tabId === tabId && t.url.includes('changed')));
@@ -1335,7 +1335,7 @@ class ApiTests extends ApiTestFixtureBase {
13351335
assertDefined(this.host.pinTabs);
13361336

13371337
const tabId = this.testParams.tabId;
1338-
assertNotEquals(tabId, this.getFocusedTabId());
1338+
assertNotEquals(tabId, this.getActiveTabId());
13391339

13401340
await this.host.pinTabs([tabId]);
13411341
const pinnedTabsUpdates = observeSequence(this.host.getPinnedTabs());

0 commit comments

Comments
 (0)