OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ |
| 6 #define CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 #include "content/common/notification_observer.h" |
| 11 #include "content/common/notification_registrar.h" |
| 12 |
| 13 class WebUI; |
| 14 |
| 15 // For browser_tests, which run on the UI thread, run a second message |
| 16 // MessageLoop to detect HtmlDialog creation and quit when the constructed |
| 17 // WebUI instance is captured and ready. |
| 18 class TestHtmlDialogObserver : public NotificationObserver { |
| 19 public: |
| 20 // Create and register a new TestHtmlDialogObserver. |
| 21 TestHtmlDialogObserver(); |
| 22 virtual ~TestHtmlDialogObserver(); |
| 23 |
| 24 // Waits for an HtmlDialog to be created. The WebUI instance is captured |
| 25 // and the method returns it when the navigation on the dialog is complete. |
| 26 WebUI* GetWebUI(); |
| 27 |
| 28 private: |
| 29 // NotificationObserver: |
| 30 virtual void Observe(int type, const NotificationSource& source, |
| 31 const NotificationDetails& details) OVERRIDE; |
| 32 |
| 33 NotificationRegistrar registrar_; |
| 34 |
| 35 WebUI* web_ui_; |
| 36 bool done_; |
| 37 bool running_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver); |
| 40 }; |
| 41 |
| 42 #endif // CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ |
OLD | NEW |