Chromium Code Reviews| 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_); | 84 CHECK(host_); |
|
achuithb
2016/01/22 22:37:08
nit: drop CHECK since line below crashes
jdufault
2016/01/22 23:04:15
Done.
| |
| 85 content::WebContents* web_contents = | 85 content::WebContents* web_contents = |
| 86 LoginDisplayHostImpl::default_host()->GetWebUILoginView()-> | 86 host_->GetWebUILoginView()->GetWebContents(); |
| 87 GetWebContents(); | |
| 88 captive_portal_window_proxy_.reset( | 87 captive_portal_window_proxy_.reset( |
| 89 new CaptivePortalWindowProxy(&delegate_, web_contents)); | 88 new CaptivePortalWindowProxy(&delegate_, web_contents)); |
| 90 } | 89 } |
| 91 | 90 |
| 92 void TearDownOnMainThread() override { | 91 void TearDownOnMainThread() override { |
| 93 captive_portal_window_proxy_.reset(); | 92 captive_portal_window_proxy_.reset(); |
| 94 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); | 93 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); |
| 95 base::MessageLoopForUI::current()->RunUntilIdle(); | 94 base::MessageLoopForUI::current()->RunUntilIdle(); |
| 96 } | 95 } |
| 97 | 96 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 NetworkPortalDetectorTestImpl* network_portal_detector_; | 206 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 208 | 207 |
| 209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); | 208 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); |
| 210 }; | 209 }; |
| 211 | 210 |
| 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { | 211 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { |
| 213 StartupUtils::MarkOobeCompleted(); | 212 StartupUtils::MarkOobeCompleted(); |
| 214 } | 213 } |
| 215 | 214 |
| 216 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { | 215 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { |
| 217 LoginDisplayHostImpl* host = | 216 LoginDisplayHost* host = LoginDisplayHost::default_host(); |
| 218 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); | |
| 219 ASSERT_TRUE(host); | 217 ASSERT_TRUE(host); |
| 220 OobeUI* oobe = host->GetOobeUI(); | 218 OobeUI* oobe = host->GetOobeUI(); |
| 221 ASSERT_TRUE(oobe); | 219 ASSERT_TRUE(oobe); |
| 222 | 220 |
| 223 // Error screen asks portal detector to change detection strategy. | 221 // Error screen asks portal detector to change detection strategy. |
| 224 ErrorScreen* error_screen = oobe->GetErrorScreen(); | 222 ErrorScreen* error_screen = oobe->GetErrorScreen(); |
| 225 ASSERT_TRUE(error_screen); | 223 ASSERT_TRUE(error_screen); |
| 226 | 224 |
| 227 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); | 225 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); |
| 228 network_portal_detector()->NotifyObserversForTesting(); | 226 network_portal_detector()->NotifyObserversForTesting(); |
| 229 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 227 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 230 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); | 228 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); |
| 231 | 229 |
| 232 error_screen->ShowCaptivePortal(); | 230 error_screen->ShowCaptivePortal(); |
| 233 } | 231 } |
| 234 | 232 |
| 235 } // namespace chromeos | 233 } // namespace chromeos |
| OLD | NEW |