OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" |
13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
14 #include "chrome/browser/chromeos/login/login_manager_test.h" | 16 #include "chrome/browser/chromeos/login/login_manager_test.h" |
15 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 17 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
16 #include "chrome/browser/chromeos/login/screens/network_error_view.h" | 18 #include "chrome/browser/chromeos/login/screens/network_error_view.h" |
17 #include "chrome/browser/chromeos/login/startup_utils.h" | 19 #include "chrome/browser/chromeos/login/startup_utils.h" |
18 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 20 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
19 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" | 21 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" |
20 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 22 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
21 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 23 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
22 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 24 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void SetUpOnMainThread() override { | 88 void SetUpOnMainThread() override { |
87 host_ = LoginDisplayHost::default_host(); | 89 host_ = LoginDisplayHost::default_host(); |
88 content::WebContents* web_contents = | 90 content::WebContents* web_contents = |
89 host_->GetWebUILoginView()->GetWebContents(); | 91 host_->GetWebUILoginView()->GetWebContents(); |
90 captive_portal_window_proxy_.reset( | 92 captive_portal_window_proxy_.reset( |
91 new CaptivePortalWindowProxy(&delegate_, web_contents)); | 93 new CaptivePortalWindowProxy(&delegate_, web_contents)); |
92 } | 94 } |
93 | 95 |
94 void TearDownOnMainThread() override { | 96 void TearDownOnMainThread() override { |
95 captive_portal_window_proxy_.reset(); | 97 captive_portal_window_proxy_.reset(); |
96 base::MessageLoopForUI::current()->task_runner()->DeleteSoon(FROM_HERE, | 98 |
97 host_); | 99 ASSERT_TRUE(base::MessageLoopForUI::IsCurrent()); |
98 base::MessageLoopForUI::current()->RunUntilIdle(); | 100 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_); |
| 101 base::RunLoop().RunUntilIdle(); |
99 } | 102 } |
100 | 103 |
101 private: | 104 private: |
102 std::unique_ptr<CaptivePortalWindowProxy> captive_portal_window_proxy_; | 105 std::unique_ptr<CaptivePortalWindowProxy> captive_portal_window_proxy_; |
103 CaptivePortalWindowProxyStubDelegate delegate_; | 106 CaptivePortalWindowProxyStubDelegate delegate_; |
104 | 107 |
105 LoginDisplayHost* host_; | 108 LoginDisplayHost* host_; |
106 }; | 109 }; |
107 | 110 |
108 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowTest, Show) { | 111 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowTest, Show) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 231 |
229 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); | 232 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); |
230 network_portal_detector()->NotifyObserversForTesting(); | 233 network_portal_detector()->NotifyObserversForTesting(); |
231 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); | 234 OobeScreenWaiter(OobeScreen::SCREEN_ERROR_MESSAGE).Wait(); |
232 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); | 235 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); |
233 | 236 |
234 error_screen->ShowCaptivePortal(); | 237 error_screen->ShowCaptivePortal(); |
235 } | 238 } |
236 | 239 |
237 } // namespace chromeos | 240 } // namespace chromeos |
OLD | NEW |