diff options
Diffstat (limited to 'chrome/test/ui_test_utils.cc')
-rw-r--r-- | chrome/test/ui_test_utils.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index d1cd7d3..fb1ec65 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -259,6 +259,26 @@ class SimpleNotificationObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(SimpleNotificationObserver); }; +class TabParentedNotificationObserver : public NotificationObserver { + public: + TabParentedNotificationObserver() { + registrar_.Add(this, NotificationType::TAB_PARENTED, + NotificationService::AllSources()); + ui_test_utils::RunMessageLoop(); + } + + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + MessageLoopForUI::current()->Quit(); + } + + private: + NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(TabParentedNotificationObserver); +}; + class LanguageDetectionNotificationObserver : public NotificationObserver { public: explicit LanguageDetectionNotificationObserver(TabContents* tab) { @@ -395,6 +415,10 @@ void WaitForNewTab(Browser* browser) { new_tab_observer(NotificationType::TAB_ADDED, browser); } +void WaitForTabParented() { + TabParentedNotificationObserver new_tab_observer; +} + void WaitForLoadStop(NavigationController* controller) { SimpleNotificationObserver<NavigationController> new_tab_observer(NotificationType::LOAD_STOP, controller); |