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

Side by Side Diff: chrome/test/base/test_html_dialog_observer.h

Issue 8586009: Allow WebUI Tests to use preLoad in HtmlDialogUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ 5 #ifndef CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
6 #define CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ 6 #define CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 12
13 class JsInjectionReadyObserver;
13 class WebUI; 14 class WebUI;
14 15
15 // For browser_tests, which run on the UI thread, run a second message 16 // 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 // MessageLoop to detect HtmlDialog creation and quit when the constructed
17 // WebUI instance is captured and ready. 18 // WebUI instance is captured and ready.
18 class TestHtmlDialogObserver : public content::NotificationObserver { 19 class TestHtmlDialogObserver : public content::NotificationObserver {
19 public: 20 public:
20 // Create and register a new TestHtmlDialogObserver. 21 // Create and register a new TestHtmlDialogObserver. If
21 TestHtmlDialogObserver(); 22 // |js_injection_ready_observer| is non-NULL, notify it as soon as the RVH is
23 // available.
24 explicit TestHtmlDialogObserver(
25 JsInjectionReadyObserver* js_injection_ready_observer);
22 virtual ~TestHtmlDialogObserver(); 26 virtual ~TestHtmlDialogObserver();
23 27
24 // Waits for an HtmlDialog to be created. The WebUI instance is captured 28 // 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. 29 // and the method returns it when the navigation on the dialog is complete.
26 WebUI* GetWebUI(); 30 WebUI* GetWebUI();
27 31
28 private: 32 private:
29 // content::NotificationObserver: 33 // content::NotificationObserver:
30 virtual void Observe(int type, const content::NotificationSource& source, 34 virtual void Observe(int type, const content::NotificationSource& source,
31 const content::NotificationDetails& details) OVERRIDE; 35 const content::NotificationDetails& details) OVERRIDE;
32 36
33 content::NotificationRegistrar registrar_; 37 content::NotificationRegistrar registrar_;
34 38
39 // Observer to take some action when the dialog is ready for JavaScript
40 // injection.
41 JsInjectionReadyObserver* js_injection_ready_observer_;
35 WebUI* web_ui_; 42 WebUI* web_ui_;
36 bool done_; 43 bool done_;
37 bool running_; 44 bool running_;
38 45
39 DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver); 46 DISALLOW_COPY_AND_ASSIGN(TestHtmlDialogObserver);
40 }; 47 };
41 48
42 #endif // CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_ 49 #endif // CHROME_TEST_BASE_TEST_HTML_DIALOG_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/test/base/js_injection_ready_observer.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