| OLD | NEW |
| 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_web_dialog_observer.h" | 5 #include "chrome/test/base/test_web_dialog_observer.h" |
| 6 | 6 |
| 7 #include "chrome/test/base/ui_test_utils.h" | 7 #include "chrome/test/base/ui_test_utils.h" |
| 8 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/notification_details.h" | 10 #include "content/public/browser/notification_details.h" |
| 11 #include "content/public/browser/notification_source.h" | 11 #include "content/public/browser/notification_source.h" |
| 12 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 #include "content/public/test/js_injection_ready_observer.h" | 15 #include "content/public/test/js_injection_ready_observer.h" |
| 16 #include "content/public/test/test_utils.h" |
| 16 | 17 |
| 17 using content::NavigationController; | 18 using content::NavigationController; |
| 18 | 19 |
| 19 TestWebDialogObserver::TestWebDialogObserver( | 20 TestWebDialogObserver::TestWebDialogObserver( |
| 20 content::JsInjectionReadyObserver* js_injection_ready_observer) | 21 content::JsInjectionReadyObserver* js_injection_ready_observer) |
| 21 : js_injection_ready_observer_(js_injection_ready_observer), | 22 : js_injection_ready_observer_(js_injection_ready_observer), |
| 22 web_ui_(NULL), | 23 web_ui_(NULL), |
| 23 done_(false), | 24 done_(false), |
| 24 running_(false) { | 25 running_(false) { |
| 25 } | 26 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // navigate in this method, ensuring that this is not a race condition. | 67 // navigate in this method, ensuring that this is not a race condition. |
| 67 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 68 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
| 68 content::Source<NavigationController>( | 69 content::Source<NavigationController>( |
| 69 &web_ui_->GetWebContents()->GetController())); | 70 &web_ui_->GetWebContents()->GetController())); |
| 70 } | 71 } |
| 71 | 72 |
| 72 content::WebUI* TestWebDialogObserver::GetWebUI() { | 73 content::WebUI* TestWebDialogObserver::GetWebUI() { |
| 73 if (!done_) { | 74 if (!done_) { |
| 74 EXPECT_FALSE(running_); | 75 EXPECT_FALSE(running_); |
| 75 running_ = true; | 76 running_ = true; |
| 76 message_loop_runner_ = new ui_test_utils::MessageLoopRunner; | 77 message_loop_runner_ = new content::MessageLoopRunner; |
| 77 message_loop_runner_->Run(); | 78 message_loop_runner_->Run(); |
| 78 } | 79 } |
| 79 return web_ui_; | 80 return web_ui_; |
| 80 } | 81 } |
| OLD | NEW |