Chromium Code Reviews| Index: chrome/test/test_html_dialog_observer.h |
| diff --git a/chrome/test/test_html_dialog_observer.h b/chrome/test/test_html_dialog_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..87ae6db9cc71e879226bd56dbdaf0c4c78552555 |
| --- /dev/null |
| +++ b/chrome/test/test_html_dialog_observer.h |
| @@ -0,0 +1,39 @@ |
| +// Copyright (c) 2011 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. |
| + |
| +#ifndef CHROME_TEST_TEST_HTML_DIALOG_OBSERVER_H_ |
| +#define CHROME_TEST_TEST_HTML_DIALOG_OBSERVER_H_ |
| +#pragma once |
| + |
| +#include "content/common/notification_observer.h" |
| +#include "content/common/notification_registrar.h" |
| + |
| +class WebUI; |
| + |
| +// For browser_tests, which run on the UI thread, run a second message |
| +// MessageLoop to detect HtmlDialog creation and quit when the constructed |
| +// WebUI instance is captured and ready. |
| +class TestHtmlDialogObserver : public NotificationObserver { |
| + public: |
| + // Create and register a new TestHtmlDialogObserver. |
| + TestHtmlDialogObserver(); |
| + virtual ~TestHtmlDialogObserver(); |
| + |
| + // Waits for an HtmlDialog to be created. The WebUI instance is captured |
| + // and the method returns it when the navigation on the dialog is complete. |
| + WebUI* GetWebUI(); |
| + |
| + private: |
| + // NotificationObserver: |
| + virtual void Observe(int type, const NotificationSource& source, |
| + const NotificationDetails& details); |
| + |
| + NotificationRegistrar registrar_; |
| + |
| + WebUI* web_ui_; |
| + bool done_; |
| + bool running_; |
| +}; |
|
Sheridan Rawlins
2011/09/15 19:11:41
DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver);
flackr
2011/09/15 21:02:36
Done.
|
| + |
| +#endif // CHROME_TEST_TEST_HTML_DIALOG_OBSERVER_H_ |