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 |
202 private: | 206 private: |
203 NetworkPortalDetectorTestImpl* network_portal_detector_; | 207 NetworkPortalDetectorTestImpl* network_portal_detector_; |
204 | 208 |
205 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); | 209 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); |
206 }; | 210 }; |
207 | 211 |
208 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { | 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { |
209 StartupUtils::MarkOobeCompleted(); | 213 StartupUtils::MarkOobeCompleted(); |
210 } | 214 } |
211 | 215 |
212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { | 216 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { |
213 network_portal_detector()->NotifyObserversForTesting(); | |
214 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | |
215 LoginDisplayHostImpl* host = | 217 LoginDisplayHostImpl* host = |
216 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); | 218 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); |
217 | |
218 ASSERT_TRUE(host); | 219 ASSERT_TRUE(host); |
219 OobeUI* oobe = host->GetOobeUI(); | 220 OobeUI* oobe = host->GetOobeUI(); |
220 ASSERT_TRUE(oobe); | 221 ASSERT_TRUE(oobe); |
221 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); | 222 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); |
222 ASSERT_TRUE(actor); | 223 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 |
223 actor->ShowCaptivePortal(); | 233 actor->ShowCaptivePortal(); |
224 } | 234 } |
225 | 235 |
226 } // namespace chromeos | 236 } // namespace chromeos |
OLD | NEW |