| 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" |
| 11 #include "chrome/browser/chromeos/login/login_manager_test.h" | 11 #include "chrome/browser/chromeos/login/login_manager_test_helper.h" |
| 12 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 14 #include "chrome/browser/chromeos/login/webui_login_view.h" | 14 #include "chrome/browser/chromeos/login/webui_login_view.h" |
| 15 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 15 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 OnRedirected(); | 167 OnRedirected(); |
| 168 CheckState(true, 2); | 168 CheckState(true, 2); |
| 169 | 169 |
| 170 Close(); | 170 Close(); |
| 171 CheckState(false, 2); | 171 CheckState(false, 2); |
| 172 | 172 |
| 173 OnOriginalURLLoaded(); | 173 OnOriginalURLLoaded(); |
| 174 CheckState(false, 2); | 174 CheckState(false, 2); |
| 175 } | 175 } |
| 176 | 176 |
| 177 class CaptivePortalWindowCtorDtorTest : public LoginManagerTest { | 177 class CaptivePortalWindowCtorDtorTest : public InProcessBrowserTest { |
| 178 public: | 178 public: |
| 179 CaptivePortalWindowCtorDtorTest() | 179 CaptivePortalWindowCtorDtorTest() |
| 180 : LoginManagerTest(false) {} | 180 : login_manager_test_helper_(new LoginManagerTestHelper(false)) { |
| 181 set_exit_when_last_browser_closes(false); |
| 182 } |
| 183 |
| 181 virtual ~CaptivePortalWindowCtorDtorTest() {} | 184 virtual ~CaptivePortalWindowCtorDtorTest() {} |
| 182 | 185 |
| 186 virtual void SetUpOnMainThread() OVERRIDE { |
| 187 login_manager_test_helper_->SetUp(); |
| 188 } |
| 189 |
| 190 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 191 login_manager_test_helper_->SetUpCommandLine(command_line); |
| 192 } |
| 193 |
| 183 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 194 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 184 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 195 login_manager_test_helper_->SetUpLoginUtils(); |
| 185 | 196 |
| 186 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); | 197 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); |
| 187 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); | 198 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); |
| 188 NetworkPortalDetector::CaptivePortalState portal_state; | 199 NetworkPortalDetector::CaptivePortalState portal_state; |
| 189 portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; | 200 portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; |
| 190 portal_state.response_code = 200; | 201 portal_state.response_code = 200; |
| 191 network_portal_detector_->SetDefaultNetworkPathForTesting( | 202 network_portal_detector_->SetDefaultNetworkPathForTesting( |
| 192 kStubEthernetServicePath); | 203 kStubEthernetServicePath); |
| 193 network_portal_detector_->SetDetectionResultsForTesting( | 204 network_portal_detector_->SetDetectionResultsForTesting( |
| 194 kStubEthernetServicePath, portal_state); | 205 kStubEthernetServicePath, portal_state); |
| 195 } | 206 } |
| 196 | 207 |
| 208 virtual void CleanUpOnMainThread() OVERRIDE { |
| 209 login_manager_test_helper_->CleanUp(); |
| 210 } |
| 211 |
| 197 protected: | 212 protected: |
| 198 NetworkPortalDetectorTestImpl* network_portal_detector() { | 213 NetworkPortalDetectorTestImpl* network_portal_detector() { |
| 199 return network_portal_detector_; | 214 return network_portal_detector_; |
| 200 } | 215 } |
| 201 | 216 |
| 217 scoped_ptr<LoginManagerTestHelper> login_manager_test_helper_; |
| 218 |
| 202 private: | 219 private: |
| 203 NetworkPortalDetectorTestImpl* network_portal_detector_; | 220 NetworkPortalDetectorTestImpl* network_portal_detector_; |
| 204 | 221 |
| 205 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); | 222 DISALLOW_COPY_AND_ASSIGN(CaptivePortalWindowCtorDtorTest); |
| 206 }; | 223 }; |
| 207 | 224 |
| 208 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { | 225 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, PRE_OpenPortalDialog) { |
| 209 StartupUtils::MarkOobeCompleted(); | 226 StartupUtils::MarkOobeCompleted(); |
| 210 } | 227 } |
| 211 | 228 |
| 212 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { | 229 IN_PROC_BROWSER_TEST_F(CaptivePortalWindowCtorDtorTest, OpenPortalDialog) { |
| 213 network_portal_detector()->NotifyObserversForTesting(); | 230 network_portal_detector()->NotifyObserversForTesting(); |
| 214 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 231 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
| 215 LoginDisplayHostImpl* host = | 232 LoginDisplayHostImpl* host = |
| 216 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); | 233 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()); |
| 217 | 234 |
| 218 ASSERT_TRUE(host); | 235 ASSERT_TRUE(host); |
| 219 OobeUI* oobe = host->GetOobeUI(); | 236 OobeUI* oobe = host->GetOobeUI(); |
| 220 ASSERT_TRUE(oobe); | 237 ASSERT_TRUE(oobe); |
| 221 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); | 238 ErrorScreenActor* actor = oobe->GetErrorScreenActor(); |
| 222 ASSERT_TRUE(actor); | 239 ASSERT_TRUE(actor); |
| 223 actor->ShowCaptivePortal(); | 240 actor->ShowCaptivePortal(); |
| 224 } | 241 } |
| 225 | 242 |
| 226 } // namespace chromeos | 243 } // namespace chromeos |
| OLD | NEW |