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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/test/base/in_process_browser_test.cc ('k') | chrome/test/base/testing_browser_process.h » ('j') | 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) 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 #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/common/notification_service.h" 8 #include "content/public/browser/notification_service.h"
9 #include "content/browser/tab_contents/navigation_controller.h" 9 #include "content/browser/tab_contents/navigation_controller.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
11 #include "content/browser/webui/web_ui.h" 11 #include "content/browser/webui/web_ui.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 "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 16
17 TestHtmlDialogObserver::TestHtmlDialogObserver() 17 TestHtmlDialogObserver::TestHtmlDialogObserver()
18 : web_ui_(NULL), done_(false), running_(false) { 18 : web_ui_(NULL), done_(false), running_(false) {
19 registrar_.Add(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 19 registrar_.Add(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN,
20 NotificationService::AllSources()); 20 content::NotificationService::AllSources());
21 } 21 }
22 22
23 TestHtmlDialogObserver::~TestHtmlDialogObserver() { 23 TestHtmlDialogObserver::~TestHtmlDialogObserver() {
24 } 24 }
25 25
26 void TestHtmlDialogObserver::Observe( 26 void TestHtmlDialogObserver::Observe(
27 int type, 27 int type,
28 const content::NotificationSource& source, 28 const content::NotificationSource& source,
29 const content::NotificationDetails& details) { 29 const content::NotificationDetails& details) {
30 switch (type) { 30 switch (type) {
31 case chrome::NOTIFICATION_HTML_DIALOG_SHOWN: 31 case chrome::NOTIFICATION_HTML_DIALOG_SHOWN:
32 web_ui_ = content::Source<WebUI>(source).ptr(); 32 web_ui_ = content::Source<WebUI>(source).ptr();
33 registrar_.Remove(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 33 registrar_.Remove(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN,
34 NotificationService::AllSources()); 34 content::NotificationService::AllSources());
35 // Wait for navigation on the new WebUI instance to complete. This depends 35 // Wait for navigation on the new WebUI instance to complete. This depends
36 // on receiving the notification of the HtmlDialog being shown before the 36 // on receiving the notification of the HtmlDialog being shown before the
37 // NavigationController finishes loading. The HtmlDialog notification is 37 // NavigationController finishes loading. The HtmlDialog notification is
38 // issued from html_dialog_ui.cc on RenderView creation which results from 38 // issued from html_dialog_ui.cc on RenderView creation which results from
39 // the call to render_manager_.Navigate in the method 39 // the call to render_manager_.Navigate in the method
40 // TabContents::NavigateToEntry. The new RenderView is later told to 40 // TabContents::NavigateToEntry. The new RenderView is later told to
41 // navigate in this method, ensuring that this is not a race condition. 41 // navigate in this method, ensuring that this is not a race condition.
42 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 42 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
43 content::Source<NavigationController>( 43 content::Source<NavigationController>(
44 &web_ui_->tab_contents()->controller())); 44 &web_ui_->tab_contents()->controller()));
(...skipping 16 matching lines...) Expand all
61 } 61 }
62 62
63 WebUI* TestHtmlDialogObserver::GetWebUI() { 63 WebUI* TestHtmlDialogObserver::GetWebUI() {
64 if (!done_) { 64 if (!done_) {
65 EXPECT_FALSE(running_); 65 EXPECT_FALSE(running_);
66 running_ = true; 66 running_ = true;
67 ui_test_utils::RunMessageLoop(); 67 ui_test_utils::RunMessageLoop();
68 } 68 }
69 return web_ui_; 69 return web_ui_;
70 } 70 }
OLDNEW
« no previous file with comments | « chrome/test/base/in_process_browser_test.cc ('k') | chrome/test/base/testing_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698