Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/extensions/api/networking_private/networking_private_apitest.cc

Issue 219333002: Added method getCaptivePortalStatus to networkingPrivate extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chromeos/login/user.h" 8 #include "chrome/browser/chromeos/login/user.h"
9 #include "chrome/browser/chromeos/login/user_manager.h" 9 #include "chrome/browser/chromeos/login/user_manager.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
13 #include "extensions/common/switches.h" 13 #include "extensions/common/switches.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "chrome/browser/chromeos/net/network_portal_detector.h"
18 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
17 #include "chromeos/chromeos_switches.h" 19 #include "chromeos/chromeos_switches.h"
18 #include "chromeos/dbus/cryptohome_client.h" 20 #include "chromeos/dbus/cryptohome_client.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
20 #include "chromeos/dbus/shill_device_client.h" 22 #include "chromeos/dbus/shill_device_client.h"
21 #include "chromeos/dbus/shill_manager_client.h" 23 #include "chromeos/dbus/shill_manager_client.h"
22 #include "chromeos/dbus/shill_profile_client.h" 24 #include "chromeos/dbus/shill_profile_client.h"
23 #include "chromeos/dbus/shill_service_client.h" 25 #include "chromeos/dbus/shill_service_client.h"
24 #include "chromeos/network/onc/onc_utils.h" 26 #include "chromeos/network/onc/onc_utils.h"
25 #include "components/onc/onc_constants.h" 27 #include "components/onc/onc_constants.h"
26 #include "components/policy/core/browser/browser_policy_connector.h" 28 #include "components/policy/core/browser/browser_policy_connector.h"
(...skipping 11 matching lines...) Expand all
38 #endif // defined(OS_CHROMEOS) 40 #endif // defined(OS_CHROMEOS)
39 41
40 using testing::Return; 42 using testing::Return;
41 using testing::_; 43 using testing::_;
42 44
43 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
44 using chromeos::CryptohomeClient; 46 using chromeos::CryptohomeClient;
45 using chromeos::DBUS_METHOD_CALL_SUCCESS; 47 using chromeos::DBUS_METHOD_CALL_SUCCESS;
46 using chromeos::DBusMethodCallStatus; 48 using chromeos::DBusMethodCallStatus;
47 using chromeos::DBusThreadManager; 49 using chromeos::DBusThreadManager;
50 using chromeos::NetworkPortalDetector;
51 using chromeos::NetworkPortalDetectorTestImpl;
48 using chromeos::ShillDeviceClient; 52 using chromeos::ShillDeviceClient;
49 using chromeos::ShillManagerClient; 53 using chromeos::ShillManagerClient;
50 using chromeos::ShillProfileClient; 54 using chromeos::ShillProfileClient;
51 using chromeos::ShillServiceClient; 55 using chromeos::ShillServiceClient;
52 #else // !defined(OS_CHROMEOS) 56 #else // !defined(OS_CHROMEOS)
53 using extensions::NetworkingPrivateServiceClientFactory; 57 using extensions::NetworkingPrivateServiceClientFactory;
54 #endif // defined(OS_CHROMEOS) 58 #endif // defined(OS_CHROMEOS)
55 59
56 namespace { 60 namespace {
57 61
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 SetWifiTDLSEnabledState) { 452 SetWifiTDLSEnabledState) {
449 EXPECT_TRUE(RunNetworkingSubtest("setWifiTDLSEnabledState")) << message_; 453 EXPECT_TRUE(RunNetworkingSubtest("setWifiTDLSEnabledState")) << message_;
450 } 454 }
451 455
452 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, 456 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
453 GetWifiTDLSStatus) { 457 GetWifiTDLSStatus) {
454 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_; 458 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_;
455 } 459 }
456 #endif 460 #endif
457 461
462 // NetworkPortalDetector is only enabled for Chrome OS.
463 #if defined(OS_CHROMEOS)
464 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
465 GetCaptivePortalStatus) {
466 NetworkPortalDetectorTestImpl* detector = new NetworkPortalDetectorTestImpl();
467 NetworkPortalDetector::InitializeForTesting(detector);
468 NetworkPortalDetector::CaptivePortalState state;
469 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
470 detector->SetDetectionResultsForTesting("stub_ethernet", state);
471
472 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
473 detector->SetDetectionResultsForTesting("stub_wifi1", state);
474
475 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
476 detector->SetDetectionResultsForTesting("stub_wifi2", state);
477
478 state.status =
479 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
480 detector->SetDetectionResultsForTesting("stub_cellular1", state);
481
482 EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_;
483 }
484 #endif // defined(OS_CHROMEOS)
485
458 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, 486 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation,
459 ExtensionNetworkingPrivateApiTest, 487 ExtensionNetworkingPrivateApiTest,
460 testing::Bool()); 488 testing::Bool());
461 489
462 } // namespace 490 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698