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

Side by Side 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: Applied scr's review suggestions. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698