Skip to content

Commit 67b931d

Browse files
committed
test: address code quality review for back-to-opener tests
1 parent ebb729a commit 67b931d

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

src/dao/browser/ui/views/dao_browser_browsertest.cc

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,17 +2274,13 @@ class DaoBackToOpenerBrowserTest : public InProcessBrowserTest {
22742274

22752275
// Navigate the active tab to the opener fixture and click the link to spawn
22762276
// a child tab in the same browser. Returns the destination WebContents.
2277-
content::WebContents* OpenChildFromOpener(GURL* opener_url_out = nullptr) {
2277+
content::WebContents* OpenChildFromOpener() {
22782278
GURL opener_url =
22792279
embedded_test_server()->GetURL("/back_to_opener_opener.html");
2280-
if (opener_url_out) {
2281-
*opener_url_out = opener_url;
2282-
}
22832280
EXPECT_TRUE(ui_test_utils::NavigateToURL(browser(), opener_url));
22842281

22852282
content::WebContents* opener_contents =
22862283
browser()->tab_strip_model()->GetActiveWebContents();
2287-
EXPECT_TRUE(content::WaitForLoadStop(opener_contents));
22882284

22892285
ui_test_utils::TabAddedWaiter tab_waiter(browser());
22902286
EXPECT_TRUE(content::ExecJs(opener_contents,
@@ -2343,11 +2339,7 @@ IN_PROC_BROWSER_TEST_F(DaoBackToOpenerBrowserTest,
23432339
tab_strip->ActivateTabAt(opener_index);
23442340
ASSERT_EQ(opener_contents, tab_strip->GetActiveWebContents());
23452341
GURL other_url = embedded_test_server()->GetURL("/title2.html");
2346-
{
2347-
content::TestNavigationObserver nav_observer(opener_contents);
2348-
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), other_url));
2349-
nav_observer.Wait();
2350-
}
2342+
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), other_url));
23512343

23522344
// Re-focus the child tab. Its own history is empty, and the opener has
23532345
// moved on, so chrome::CanGoBack should now report false.
@@ -2470,11 +2462,10 @@ IN_PROC_BROWSER_TEST_F(DaoBackToOpenerBrowserTest,
24702462

24712463
// Even if invoked anyway, the tab count must stay at 2 (defense in depth).
24722464
const int tab_count_before = tab_strip->count();
2473-
if (chrome::CanGoBack(browser())) {
2474-
chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB);
2475-
base::RunLoop().RunUntilIdle();
2476-
}
2465+
chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB);
2466+
base::RunLoop().RunUntilIdle();
24772467
EXPECT_EQ(tab_count_before, tab_strip->count());
2468+
EXPECT_EQ(dest_contents, tab_strip->GetActiveWebContents());
24782469
}
24792470

24802471
} // namespace

0 commit comments

Comments
 (0)