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

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

Issue 10262027: Rename HTML_DIALOG to WEB_DIALOG. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/test/base/test_html_dialog_observer.h" 5 #include "chrome/test/base/test_html_dialog_observer.h"
6 6
7 #include "chrome/common/chrome_notification_types.h" 7 #include "chrome/common/chrome_notification_types.h"
8 #include "content/test/js_injection_ready_observer.h" 8 #include "content/test/js_injection_ready_observer.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/navigation_controller.h" 11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/notification_details.h" 12 #include "content/public/browser/notification_details.h"
13 #include "content/public/browser/notification_source.h" 13 #include "content/public/browser/notification_source.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
17 17
18 using content::NavigationController; 18 using content::NavigationController;
19 19
20 TestHtmlDialogObserver::TestHtmlDialogObserver( 20 TestHtmlDialogObserver::TestHtmlDialogObserver(
21 JsInjectionReadyObserver* js_injection_ready_observer) 21 JsInjectionReadyObserver* js_injection_ready_observer)
22 : js_injection_ready_observer_(js_injection_ready_observer), 22 : js_injection_ready_observer_(js_injection_ready_observer),
23 web_ui_(NULL), done_(false), running_(false) { 23 web_ui_(NULL),
24 registrar_.Add(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 24 done_(false),
25 running_(false) {
26 registrar_.Add(this, chrome::NOTIFICATION_WEB_DIALOG_SHOWN,
25 content::NotificationService::AllSources()); 27 content::NotificationService::AllSources());
26 } 28 }
27 29
28 TestHtmlDialogObserver::~TestHtmlDialogObserver() { 30 TestHtmlDialogObserver::~TestHtmlDialogObserver() {
29 } 31 }
30 32
31 void TestHtmlDialogObserver::Observe( 33 void TestHtmlDialogObserver::Observe(
32 int type, 34 int type,
33 const content::NotificationSource& source, 35 const content::NotificationSource& source,
34 const content::NotificationDetails& details) { 36 const content::NotificationDetails& details) {
35 switch (type) { 37 switch (type) {
36 case chrome::NOTIFICATION_HTML_DIALOG_SHOWN: 38 case chrome::NOTIFICATION_WEB_DIALOG_SHOWN:
37 if (js_injection_ready_observer_) { 39 if (js_injection_ready_observer_) {
38 js_injection_ready_observer_->OnJsInjectionReady( 40 js_injection_ready_observer_->OnJsInjectionReady(
39 content::Details<content::RenderViewHost>(details).ptr()); 41 content::Details<content::RenderViewHost>(details).ptr());
40 } 42 }
41 web_ui_ = content::Source<content::WebUI>(source).ptr(); 43 web_ui_ = content::Source<content::WebUI>(source).ptr();
42 registrar_.Remove(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 44 registrar_.Remove(this, chrome::NOTIFICATION_WEB_DIALOG_SHOWN,
43 content::NotificationService::AllSources()); 45 content::NotificationService::AllSources());
44 // Wait for navigation on the new WebUI instance to complete. This depends 46 // Wait for navigation on the new WebUI instance to complete. This depends
45 // on receiving the notification of the HtmlDialog being shown before the 47 // on receiving the notification of the HtmlDialog being shown before the
46 // NavigationController finishes loading. The HtmlDialog notification is 48 // NavigationController finishes loading. The HtmlDialog notification is
47 // issued from html_dialog_ui.cc on RenderView creation which results from 49 // issued from html_dialog_ui.cc on RenderView creation which results from
48 // the call to render_manager_.Navigate in the method 50 // the call to render_manager_.Navigate in the method
49 // WebContents::NavigateToEntry. The new RenderView is later told to 51 // WebContents::NavigateToEntry. The new RenderView is later told to
50 // navigate in this method, ensuring that this is not a race condition. 52 // navigate in this method, ensuring that this is not a race condition.
51 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 53 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
52 content::Source<NavigationController>( 54 content::Source<NavigationController>(
(...skipping 17 matching lines...) Expand all
70 } 72 }
71 73
72 content::WebUI* TestHtmlDialogObserver::GetWebUI() { 74 content::WebUI* TestHtmlDialogObserver::GetWebUI() {
73 if (!done_) { 75 if (!done_) {
74 EXPECT_FALSE(running_); 76 EXPECT_FALSE(running_);
75 running_ = true; 77 running_ = true;
76 ui_test_utils::RunMessageLoop(); 78 ui_test_utils::RunMessageLoop();
77 } 79 }
78 return web_ui_; 80 return web_ui_;
79 } 81 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_notification_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698