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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
11 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 11 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
12 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" | 12 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" |
13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
14 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 14 #include "chrome/browser/chromeos/login/ui/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 #include "chromeos/dbus/fake_shill_manager_client.h" |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 const char kStubEthernetServicePath[] = "eth1"; | |
25 | |
26 // Stub implementation of CaptivePortalWindowProxyDelegate, does | 25 // Stub implementation of CaptivePortalWindowProxyDelegate, does |
27 // nothing and used to instantiate CaptivePortalWindowProxy. | 26 // nothing and used to instantiate CaptivePortalWindowProxy. |
28 class CaptivePortalWindowProxyStubDelegate | 27 class CaptivePortalWindowProxyStubDelegate |
29 : public CaptivePortalWindowProxyDelegate { | 28 : public CaptivePortalWindowProxyDelegate { |
30 public: | 29 public: |
31 CaptivePortalWindowProxyStubDelegate(): num_portal_notifications_(0) { | 30 CaptivePortalWindowProxyStubDelegate(): num_portal_notifications_(0) { |
32 } | 31 } |
33 | 32 |
34 virtual ~CaptivePortalWindowProxyStubDelegate() { | 33 virtual ~CaptivePortalWindowProxyStubDelegate() { |
35 } | 34 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 181 |
183 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 182 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
184 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 183 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
185 | 184 |
186 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); | 185 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); |
187 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); | 186 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); |
188 NetworkPortalDetector::CaptivePortalState portal_state; | 187 NetworkPortalDetector::CaptivePortalState portal_state; |
189 portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; | 188 portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; |
190 portal_state.response_code = 200; | 189 portal_state.response_code = 200; |
191 network_portal_detector_->SetDefaultNetworkPathForTesting( | 190 network_portal_detector_->SetDefaultNetworkPathForTesting( |
192 kStubEthernetServicePath); | 191 FakeShillManagerClient::kFakeEthernetNetworkPath); |
193 network_portal_detector_->SetDetectionResultsForTesting( | 192 network_portal_detector_->SetDetectionResultsForTesting( |
194 kStubEthernetServicePath, portal_state); | 193 FakeShillManagerClient::kFakeEthernetNetworkPath, portal_state); |
195 } | 194 } |
196 | 195 |
197 protected: | 196 protected: |
198 NetworkPortalDetectorTestImpl* network_portal_detector() { | 197 NetworkPortalDetectorTestImpl* network_portal_detector() { |
199 return network_portal_detector_; | 198 return network_portal_detector_; |
200 } | 199 } |
201 | 200 |
202 PortalDetectorStrategy::StrategyId strategy_id() { | 201 PortalDetectorStrategy::StrategyId strategy_id() { |
203 return network_portal_detector_->strategy_id(); | 202 return network_portal_detector_->strategy_id(); |
204 } | 203 } |
(...skipping 22 matching lines...) Expand all Loading... |
227 | 226 |
228 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); | 227 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN, strategy_id()); |
229 network_portal_detector()->NotifyObserversForTesting(); | 228 network_portal_detector()->NotifyObserversForTesting(); |
230 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); | 229 OobeScreenWaiter(OobeDisplay::SCREEN_ERROR_MESSAGE).Wait(); |
231 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); | 230 ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN, strategy_id()); |
232 | 231 |
233 actor->ShowCaptivePortal(); | 232 actor->ShowCaptivePortal(); |
234 } | 233 } |
235 | 234 |
236 } // namespace chromeos | 235 } // namespace chromeos |
OLD | NEW |