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

Unified Diff: chrome/test/base/test_html_dialog_observer.h

Issue 7861024: Adds testing infrastructure to web_ui_browsertest to support testing HtmlDialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove inline override function declaration for clang. Created 9 years, 3 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
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | chrome/test/base/test_html_dialog_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/test_html_dialog_observer.h
diff --git a/chrome/test/base/test_html_dialog_observer.h b/chrome/test/base/test_html_dialog_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2188c34b5fc4153cd92555f1a7930e0690730dd
--- /dev/null
+++ b/chrome/test/base/test_html_dialog_observer.h
@@ -0,0 +1,42 @@
+// 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_BASE_TEST_HTML_DIALOG_OBSERVER_H_
+#define CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#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) OVERRIDE;
+
+ NotificationRegistrar registrar_;
+
+ WebUI* web_ui_;
+ bool done_;
+ bool running_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver);
+};
+
+#endif // CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | chrome/test/base/test_html_dialog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698