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

Unified Diff: chrome/test/ui_test_utils.cc

Issue 7046053: Add PrerenderUnload browser test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove include Created 9 years, 6 months 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
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui_test_utils.cc
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index a0f2fb1325b1d21e12c387064c900596e43ccc95..fe9cb711c481931a63b0c799d2f967476e36a0cf 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -889,6 +889,45 @@ void WindowedNotificationObserver::Observe(NotificationType type,
}
}
+TitleWatcher::TitleWatcher(TabContents* tab_contents,
+ const string16& expected_title)
+ : expected_tab_(tab_contents),
+ expected_title_(expected_title),
+ title_observed_(false),
+ quit_loop_on_observation_(false) {
+ EXPECT_TRUE(tab_contents != NULL);
+ notification_registrar_.Add(this,
+ NotificationType::TAB_CONTENTS_TITLE_UPDATED,
+ Source<TabContents>(tab_contents));
+}
+
+TitleWatcher::~TitleWatcher() {
+}
+
+bool TitleWatcher::Wait() {
+ if (title_observed_)
+ return true;
+ quit_loop_on_observation_ = true;
+ ui_test_utils::RunMessageLoop();
+ return title_observed_;
+}
+
+void TitleWatcher::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type != NotificationType::TAB_CONTENTS_TITLE_UPDATED)
+ return;
+
+ TabContents* source_contents = Source<TabContents>(source).ptr();
+ ASSERT_EQ(expected_tab_, source_contents);
+ if (source_contents->GetTitle() != expected_title_)
+ return;
+
+ title_observed_ = true;
+ if (quit_loop_on_observation_)
+ MessageLoopForUI::current()->Quit();
+}
+
DOMMessageQueue::DOMMessageQueue() {
registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE,
NotificationService::AllSources());
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698