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

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

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
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/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/browser/tab_contents/navigation_controller.h" 11 #include "content/browser/tab_contents/navigation_controller.h"
12 #include "content/browser/tab_contents/tab_contents.h"
13 #include "content/browser/webui/web_ui.h" 12 #include "content/browser/webui/web_ui.h"
14 #include "content/public/browser/notification_details.h" 13 #include "content/public/browser/notification_details.h"
15 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
16 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
16 #include "content/public/browser/web_contents.h"
17 17
18 TestHtmlDialogObserver::TestHtmlDialogObserver( 18 TestHtmlDialogObserver::TestHtmlDialogObserver(
19 JsInjectionReadyObserver* js_injection_ready_observer) 19 JsInjectionReadyObserver* js_injection_ready_observer)
20 : js_injection_ready_observer_(js_injection_ready_observer), 20 : js_injection_ready_observer_(js_injection_ready_observer),
21 web_ui_(NULL), done_(false), running_(false) { 21 web_ui_(NULL), done_(false), running_(false) {
22 registrar_.Add(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN, 22 registrar_.Add(this, chrome::NOTIFICATION_HTML_DIALOG_SHOWN,
23 content::NotificationService::AllSources()); 23 content::NotificationService::AllSources());
24 } 24 }
25 25
26 TestHtmlDialogObserver::~TestHtmlDialogObserver() { 26 TestHtmlDialogObserver::~TestHtmlDialogObserver() {
(...skipping 14 matching lines...) Expand all
41 content::NotificationService::AllSources()); 41 content::NotificationService::AllSources());
42 // Wait for navigation on the new WebUI instance to complete. This depends 42 // Wait for navigation on the new WebUI instance to complete. This depends
43 // on receiving the notification of the HtmlDialog being shown before the 43 // on receiving the notification of the HtmlDialog being shown before the
44 // NavigationController finishes loading. The HtmlDialog notification is 44 // NavigationController finishes loading. The HtmlDialog notification is
45 // issued from html_dialog_ui.cc on RenderView creation which results from 45 // issued from html_dialog_ui.cc on RenderView creation which results from
46 // the call to render_manager_.Navigate in the method 46 // the call to render_manager_.Navigate in the method
47 // TabContents::NavigateToEntry. The new RenderView is later told to 47 // TabContents::NavigateToEntry. The new RenderView is later told to
48 // navigate in this method, ensuring that this is not a race condition. 48 // navigate in this method, ensuring that this is not a race condition.
49 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 49 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
50 content::Source<NavigationController>( 50 content::Source<NavigationController>(
51 &web_ui_->tab_contents()->GetController())); 51 &web_ui_->web_contents()->GetController()));
52 break; 52 break;
53 case content::NOTIFICATION_LOAD_STOP: 53 case content::NOTIFICATION_LOAD_STOP:
54 DCHECK(web_ui_); 54 DCHECK(web_ui_);
55 registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, 55 registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP,
56 content::Source<NavigationController>( 56 content::Source<NavigationController>(
57 &web_ui_->tab_contents()->GetController())); 57 &web_ui_->web_contents()->GetController()));
58 done_ = true; 58 done_ = true;
59 // If the message loop is running stop it. 59 // If the message loop is running stop it.
60 if (running_) { 60 if (running_) {
61 running_ = false; 61 running_ = false;
62 MessageLoopForUI::current()->Quit(); 62 MessageLoopForUI::current()->Quit();
63 } 63 }
64 break; 64 break;
65 default: 65 default:
66 NOTREACHED(); 66 NOTREACHED();
67 }; 67 };
68 } 68 }
69 69
70 WebUI* TestHtmlDialogObserver::GetWebUI() { 70 WebUI* TestHtmlDialogObserver::GetWebUI() {
71 if (!done_) { 71 if (!done_) {
72 EXPECT_FALSE(running_); 72 EXPECT_FALSE(running_);
73 running_ = true; 73 running_ = true;
74 ui_test_utils::RunMessageLoop(); 74 ui_test_utils::RunMessageLoop();
75 } 75 }
76 return web_ui_; 76 return web_ui_;
77 } 77 }
OLDNEW
« no previous file with comments | « chrome/test/base/test_browser_window.h ('k') | chrome/test/data/webui/certificate_viewer_ui_test-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698