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

Unified Diff: chrome/test/ui_test_utils.h

Issue 7046053: Add PrerenderUnload browser test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move TitleWatcher to ui_test_utils 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
Index: chrome/test/ui_test_utils.h
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index fefbb4feadd7b0f7832df0087adab1e890bad41d..3b735bbc62c471f53edae1f76e6151d607f222fe 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -555,6 +555,34 @@ bool TakeRenderWidgetSnapshot(RenderWidgetHost* rwh,
bool TakeEntirePageSnapshot(RenderViewHost* rvh,
SkBitmap* bitmap) WARN_UNUSED_RESULT;
+// Watches title changes on a tab, blocking until an expected title is set.
+class TitleWatcher : public NotificationObserver {
+ public:
+ // |tab_contents| must be non-NULL and needs to stay alive for the
+ // entire lifetime of |this|. |expected_title| is the title that |this|
+ // will wait for.
+ TitleWatcher(TabContents* tab_contents, const string16& expected_title);
+ ~TitleWatcher();
+
+ // Waits until the title for the tab is set to the |expected_title|
+ // passed into the constructor.
+ bool WaitForTitleChange() WARN_UNUSED_RESULT;
Paweł Hajdan Jr. 2011/06/09 20:08:27 And now, please make it consistent with WindowedNo
cbentzel 2011/06/10 00:41:31 Done.
+
+ private:
+ // NotificationObserver
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
+
+ TabContents* expected_tab_;
+ string16 expected_title_;
+ NotificationRegistrar notification_registrar_;
+ bool title_observed_;
+ bool quit_loop_on_observation_;
+
+ DISALLOW_COPY_AND_ASSIGN(TitleWatcher);
+};
+
} // namespace ui_test_utils
#endif // CHROME_TEST_UI_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698