| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/login/login_manager_test.h" | 10 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 11 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 11 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 12 #include "chrome/browser/chromeos/login/screens/network_error_view.h" | 12 #include "chrome/browser/chromeos/login/screens/network_error_view.h" |
| 13 #include "chrome/browser/chromeos/login/startup_utils.h" | 13 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 15 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" | 15 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 18 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 18 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 21 #include "chromeos/dbus/fake_shill_manager_client.h" | 21 #include "chromeos/dbus/fake_shill_manager_client.h" |
| 22 #include "chromeos/network/portal_detector/network_portal_detector.h" | 22 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ASSERT_EQ(is_shown, actual_is_shown); | 73 ASSERT_EQ(is_shown, actual_is_shown); |
| 74 ASSERT_EQ(num_portal_notifications, delegate_.num_portal_notifications()); | 74 ASSERT_EQ(num_portal_notifications, delegate_.num_portal_notifications()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void SetUpCommandLine(base::CommandLine* command_line) override { | 77 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 78 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); | 78 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
| 79 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 79 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void SetUpOnMainThread() override { | 82 void SetUpOnMainThread() override { |
| 83 host_ = LoginDisplayHostImpl::default_host(); | 83 host_ = LoginDisplayHost::default_host(); |
| 84 CHECK(host_); | |
| 85 content::WebContents* web_contents = | 84 content::WebContents* web_contents = |
| 86 LoginDisplayHostImpl::default_host()->GetWebUILoginView()-> | 85 host_->GetWebUILoginView()->GetWebContents(); |
| 87 GetWebContents(); | |
| 88 captive_portal_window_proxy_.reset( | 86 captive_portal_window_proxy_.reset( |
| 89 new CaptivePortalWindowProxy(&delegate_, web_contents)); | 87 new CaptivePortalWindowProxy(&delegate_, web_contents)); |
| 90 } | 88 } |
| 91 | 89 |
| 92 void TearDownOnMainThread() override { | 90 void TearDownOnMainThread() override { |
| 93 captive_portal_window_proxy_.reset(); | 91 captive_portal_window_proxy_.reset(); |
| 94 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); | 92 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); |
| 95 base::MessageLoopForUI::current()->RunUntilIdle(); | 93 base::MessageLoopForUI::current()->RunUntilIdle(); |
| 96 } | 94 } |
| 97 | 95 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 NetworkPortalDetectorTestImpl* network_portal_detector_; | 205 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 208 | 206 |
| 209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); | 207 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); |
| 210 }; | 208 }; |
| 211 | 209 |
| 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { | 210 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { |
| 213 StartupUtils::MarkOobeCompleted(); | 211 StartupUtils::MarkOobeCompleted(); |
| 214 } | 212 } |
| 215 | 213 |
| 216 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { | 214 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { |
| 217 LoginDisplayHostImpl* host = | 215 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 218 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); | |
| 219 ASSERT_TRUE(host); | 216 ASSERT_TRUE(host); |
| 220 OobeUI* oobe = host->GetOobeUI(); | 217 OobeUI* oobe = host->GetOobeUI(); |
| 221 ASSERT_TRUE(oobe); | 218 ASSERT_TRUE(oobe); |
| 222 | 219 |
| 223 // Error screen asks portal detector to change detection strategy. | 220 // Error screen asks portal detector to change detection strategy. |
| 224 ErrorScreen* error_screen = oobe->GetErrorScreen(); | 221 ErrorScreen* error_screen = oobe->GetErrorScreen(); |
| 225 ASSERT_TRUE(error_screen); | 222 ASSERT_TRUE(error_screen); |
| 226 | 223 |
| 227 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); | 224 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); |
| 228 network_portal_detector()->NotifyObserversForTesting(); | 225 network_portal_detector()->NotifyObserversForTesting(); |
| 229 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 226 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 230 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); | 227 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); |
| 231 | 228 |
| 232 error_screen->ShowCaptivePortal(); | 229 error_screen->ShowCaptivePortal(); |
| 233 } | 230 } |
| 234 | 231 |
| 235 } // namespace chromeos | 232 } // namespace chromeos |
| OLD | NEW |