| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" | 9 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" |
| 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 10 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 kStubEthernetServicePath); | 192 kStubEthernetServicePath); |
| 193 network_portal_detector_->SetDetectionResultsForTesting( | 193 network_portal_detector_->SetDetectionResultsForTesting( |
| 194 kStubEthernetServicePath, portal_state); | 194 kStubEthernetServicePath, portal_state); |
| 195 } | 195 } |
| 196 | 196 |
| 197 protected: | 197 protected: |
| 198 NetworkPortalDetectorTestImpl* network_portal_detector() { | 198 NetworkPortalDetectorTestImpl* network_portal_detector() { |
| 199 return network_portal_detector_; | 199 return network_portal_detector_; |
| 200 } | 200 } |
| 201 | 201 |
| 202 PortalDetectorStrategy::StrategyId strategy_id() { | |
| 203 return network_portal_detector_->strategy_id(); | |
| 204 } | |
| 205 | |
| 206 private: | 202 private: |
| 207 NetworkPortalDetectorTestImpl* network_portal_detector_; | 203 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 208 | 204 |
| 209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); | 205 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); |
| 210 }; | 206 }; |
| 211 | 207 |
| 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { | 208 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { |
| 213 StartupUtils::MarkOobeCompleted(); | 209 StartupUtils::MarkOobeCompleted(); |
| 214 } | 210 } |
| 215 | 211 |
| 216 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { | 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { |
| 213 network_portal_detector()->NotifyObserversForTesting(); |
| 214 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 217 LoginDisplayHostImpl* host = | 215 LoginDisplayHostImpl* host = |
| 218 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); | 216 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); |
| 217 |
| 219 ASSERT_TRUE(host); | 218 ASSERT_TRUE(host); |
| 220 OobeUI* oobe = host->GetOobeUI(); | 219 OobeUI* oobe = host->GetOobeUI(); |
| 221 ASSERT_TRUE(oobe); | 220 ASSERT_TRUE(oobe); |
| 222 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); | 221 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); |
| 223 ASSERT_TRUE(actor); | 222 ASSERT_TRUE(actor); |
| 224 | |
| 225 // Error screen asks portal detector to change detection strategy. | |
| 226 ErrorScreen error_screen(NULL, actor); | |
| 227 | |
| 228 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); | |
| 229 network_portal_detector()->NotifyObserversForTesting(); | |
| 230 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | |
| 231 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); | |
| 232 | |
| 233 actor->ShowCaptivePortal(); | 223 actor->ShowCaptivePortal(); |
| 234 } | 224 } |
| 235 | 225 |
| 236 } // namespace chromeos | 226 } // namespace chromeos |
| OLD | NEW |