Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7744)

Unified Diff: chrome/browser/memory/tab_manager_browsertest.cc

Issue 2553993003: PlzNavigate: fix flaky TabManagerTest.TabManagerBasics browser test. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/memory/tab_manager_browsertest.cc
diff --git a/chrome/browser/memory/tab_manager_browsertest.cc b/chrome/browser/memory/tab_manager_browsertest.cc
index e991a32e9617e0e6d55e6a1bdfea5835f66ffafa..b640c54381e02206bb390fff4940d2fceeffb5c9 100644
--- a/chrome/browser/memory/tab_manager_browsertest.cc
+++ b/chrome/browser/memory/tab_manager_browsertest.cc
@@ -20,6 +20,8 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h"
+#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
@@ -36,6 +38,13 @@ namespace memory {
class TabManagerTest : public InProcessBrowserTest {
};
+bool ObserveNavEntryCommitted(const GURL& expected_url,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ return content::Details<content::LoadCommittedDetails>(details)
+ ->entry->GetURL() == expected_url;
+}
+
IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
using content::WindowedNotificationObserver;
TabManager* tab_manager = g_browser_process->GetTabManager();
@@ -135,7 +144,8 @@ IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
// Select the first tab. It should reload.
WindowedNotificationObserver reload1(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
+ base::Bind(&ObserveNavEntryCommitted,
+ GURL(chrome::kChromeUIChromeURLsURL)));
chrome::SelectNumberedTab(browser(), 0);
reload1.Wait();
// Make sure the FindBarController gets the right WebContents.
@@ -149,7 +159,7 @@ IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
// Select the third tab. It should reload.
WindowedNotificationObserver reload2(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
+ base::Bind(&ObserveNavEntryCommitted, GURL("chrome://dns")));
chrome::SelectNumberedTab(browser(), 2);
reload2.Wait();
EXPECT_EQ(2, tsm->active_index());
@@ -163,14 +173,14 @@ IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
EXPECT_FALSE(chrome::CanGoForward(browser()));
WindowedNotificationObserver back1(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
+ base::Bind(&ObserveNavEntryCommitted, GURL(chrome::kChromeUIVersionURL)));
chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB);
back1.Wait();
EXPECT_TRUE(chrome::CanGoBack(browser()));
EXPECT_TRUE(chrome::CanGoForward(browser()));
WindowedNotificationObserver back2(
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
+ base::Bind(&ObserveNavEntryCommitted, GURL(chrome::kChromeUITermsURL)));
chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB);
back2.Wait();
EXPECT_FALSE(chrome::CanGoBack(browser()));
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | content/browser/web_contents/web_contents_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698