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_ |