| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/users/user.h" | 10 #include "chrome/browser/chromeos/login/users/user.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 void AddService(const std::string& service_path, | 233 void AddService(const std::string& service_path, |
| 234 const std::string& name, | 234 const std::string& name, |
| 235 const std::string& type, | 235 const std::string& type, |
| 236 const std::string& state) { | 236 const std::string& state) { |
| 237 const bool add_to_watchlist = true; | 237 const bool add_to_watchlist = true; |
| 238 const bool add_to_visible = true; | 238 const bool add_to_visible = true; |
| 239 // Tests need a known GUID, so use 'service_path'. | 239 // Tests need a known GUID, so use 'service_path'. |
| 240 service_test_->AddServiceWithIPConfig( | 240 service_test_->AddServiceWithIPConfig( |
| 241 service_path, service_path /* guid */, name, | 241 service_path, service_path + "_GUID" /* guid */, name, |
| 242 type, state, "" /* ipconfig_path */, | 242 type, state, "" /* ipconfig_path */, |
| 243 add_to_visible, add_to_watchlist); | 243 add_to_visible, add_to_watchlist); |
| 244 } | 244 } |
| 245 | 245 |
| 246 virtual void SetUpOnMainThread() OVERRIDE { | 246 virtual void SetUpOnMainThread() OVERRIDE { |
| 247 detector_ = new NetworkPortalDetectorTestImpl(); | 247 detector_ = new NetworkPortalDetectorTestImpl(); |
| 248 NetworkPortalDetector::InitializeForTesting(detector_); | 248 NetworkPortalDetector::InitializeForTesting(detector_); |
| 249 | 249 |
| 250 ExtensionApiTest::SetUpOnMainThread(); | 250 ExtensionApiTest::SetUpOnMainThread(); |
| 251 content::RunAllPendingInMessageLoop(); | 251 content::RunAllPendingInMessageLoop(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 service_test_->SetServiceProperty("stub_wifi1", | 320 service_test_->SetServiceProperty("stub_wifi1", |
| 321 shill::kWifiFrequencyListProperty, | 321 shill::kWifiFrequencyListProperty, |
| 322 frequencies1); | 322 frequencies1); |
| 323 service_test_->SetServiceProperty("stub_wifi1", | 323 service_test_->SetServiceProperty("stub_wifi1", |
| 324 shill::kWifiFrequency, | 324 shill::kWifiFrequency, |
| 325 base::FundamentalValue(2400)); | 325 base::FundamentalValue(2400)); |
| 326 | 326 |
| 327 AddService("stub_wifi2", "wifi2_PSK", shill::kTypeWifi, shill::kStateIdle); | 327 AddService("stub_wifi2", "wifi2_PSK", shill::kTypeWifi, shill::kStateIdle); |
| 328 service_test_->SetServiceProperty("stub_wifi2", | 328 service_test_->SetServiceProperty("stub_wifi2", |
| 329 shill::kGuidProperty, | 329 shill::kGuidProperty, |
| 330 base::StringValue("stub_wifi2")); | 330 base::StringValue("stub_wifi2_GUID")); |
| 331 service_test_->SetServiceProperty("stub_wifi2", | 331 service_test_->SetServiceProperty("stub_wifi2", |
| 332 shill::kSecurityProperty, | 332 shill::kSecurityProperty, |
| 333 base::StringValue(shill::kSecurityPsk)); | 333 base::StringValue(shill::kSecurityPsk)); |
| 334 service_test_->SetServiceProperty("stub_wifi2", | 334 service_test_->SetServiceProperty("stub_wifi2", |
| 335 shill::kSignalStrengthProperty, | 335 shill::kSignalStrengthProperty, |
| 336 base::FundamentalValue(80)); | 336 base::FundamentalValue(80)); |
| 337 service_test_->SetServiceProperty("stub_wifi2", | 337 service_test_->SetServiceProperty("stub_wifi2", |
| 338 shill::kConnectableProperty, | 338 shill::kConnectableProperty, |
| 339 base::FundamentalValue(true)); | 339 base::FundamentalValue(true)); |
| 340 | 340 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 state.status = | 604 state.status = |
| 605 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; | 605 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; |
| 606 detector()->SetDetectionResultsForTesting("stub_cellular1", state); | 606 detector()->SetDetectionResultsForTesting("stub_cellular1", state); |
| 607 | 607 |
| 608 EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_; | 608 EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_; |
| 609 } | 609 } |
| 610 | 610 |
| 611 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | 611 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, |
| 612 CaptivePortalNotification) { | 612 CaptivePortalNotification) { |
| 613 detector()->SetDefaultNetworkPathForTesting("wifi"); | 613 detector()->SetDefaultNetworkPathForTesting("wifi", "wifi_GUID"); |
| 614 NetworkPortalDetector::CaptivePortalState state; | 614 NetworkPortalDetector::CaptivePortalState state; |
| 615 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; | 615 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; |
| 616 detector()->SetDetectionResultsForTesting("wifi", state); | 616 detector()->SetDetectionResultsForTesting("wifi", state); |
| 617 | 617 |
| 618 TestListener listener( | 618 TestListener listener( |
| 619 "notifyPortalDetectorObservers", | 619 "notifyPortalDetectorObservers", |
| 620 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, | 620 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, |
| 621 base::Unretained(detector()))); | 621 base::Unretained(detector()))); |
| 622 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; | 622 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; |
| 623 } | 623 } |
| 624 #endif // defined(OS_CHROMEOS) | 624 #endif // defined(OS_CHROMEOS) |
| 625 | 625 |
| 626 } // namespace | 626 } // namespace |
| OLD | NEW |