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

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: Fixed tests. 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 "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 14
15 #if defined(OS_CHROMEOS) 15 #if defined(OS_CHROMEOS)
16 #include "chrome/browser/chromeos/net/network_portal_detector.h"
17 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
16 #include "chromeos/chromeos_switches.h" 18 #include "chromeos/chromeos_switches.h"
17 #include "chromeos/dbus/cryptohome_client.h" 19 #include "chromeos/dbus/cryptohome_client.h"
18 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
19 #include "chromeos/dbus/shill_device_client.h" 21 #include "chromeos/dbus/shill_device_client.h"
20 #include "chromeos/dbus/shill_manager_client.h" 22 #include "chromeos/dbus/shill_manager_client.h"
21 #include "chromeos/dbus/shill_profile_client.h" 23 #include "chromeos/dbus/shill_profile_client.h"
22 #include "chromeos/dbus/shill_service_client.h" 24 #include "chromeos/dbus/shill_service_client.h"
23 #include "chromeos/network/onc/onc_utils.h" 25 #include "chromeos/network/onc/onc_utils.h"
24 #include "components/onc/onc_constants.h" 26 #include "components/onc/onc_constants.h"
25 #include "components/policy/core/browser/browser_policy_connector.h" 27 #include "components/policy/core/browser/browser_policy_connector.h"
(...skipping 11 matching lines...) Expand all
37 #endif // defined(OS_CHROMEOS) 39 #endif // defined(OS_CHROMEOS)
38 40
39 using testing::Return; 41 using testing::Return;
40 using testing::_; 42 using testing::_;
41 43
42 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
43 using chromeos::CryptohomeClient; 45 using chromeos::CryptohomeClient;
44 using chromeos::DBUS_METHOD_CALL_SUCCESS; 46 using chromeos::DBUS_METHOD_CALL_SUCCESS;
45 using chromeos::DBusMethodCallStatus; 47 using chromeos::DBusMethodCallStatus;
46 using chromeos::DBusThreadManager; 48 using chromeos::DBusThreadManager;
49 using chromeos::NetworkPortalDetector;
50 using chromeos::NetworkPortalDetectorTestImpl;
47 using chromeos::ShillDeviceClient; 51 using chromeos::ShillDeviceClient;
48 using chromeos::ShillManagerClient; 52 using chromeos::ShillManagerClient;
49 using chromeos::ShillProfileClient; 53 using chromeos::ShillProfileClient;
50 using chromeos::ShillServiceClient; 54 using chromeos::ShillServiceClient;
51 #else // !defined(OS_CHROMEOS) 55 #else // !defined(OS_CHROMEOS)
52 using extensions::NetworkingPrivateServiceClientFactory; 56 using extensions::NetworkingPrivateServiceClientFactory;
53 #endif // defined(OS_CHROMEOS) 57 #endif // defined(OS_CHROMEOS)
54 58
55 namespace { 59 namespace {
56 60
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 SetWifiTDLSEnabledState) { 449 SetWifiTDLSEnabledState) {
446 EXPECT_TRUE(RunNetworkingSubtest("setWifiTDLSEnabledState")) << message_; 450 EXPECT_TRUE(RunNetworkingSubtest("setWifiTDLSEnabledState")) << message_;
447 } 451 }
448 452
449 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest, 453 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
450 GetWifiTDLSStatus) { 454 GetWifiTDLSStatus) {
451 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_; 455 EXPECT_TRUE(RunNetworkingSubtest("getWifiTDLSStatus")) << message_;
452 } 456 }
453 #endif 457 #endif
454 458
459 #if defined(OS_CHROMEOS)
460 // NetworkPortalDetector is only enabled for Chrome OS.
Yoyo Zhou 2014/03/31 20:38:45 nit: comment should come before the #if def
ygorshenin1 2014/04/01 07:07:55 Done.
461 IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
462 GetCaptivePortalStatus) {
463 NetworkPortalDetectorTestImpl* detector = new NetworkPortalDetectorTestImpl();
464 NetworkPortalDetector::InitializeForTesting(detector);
465 NetworkPortalDetector::CaptivePortalState state;
466 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
467 detector->SetDetectionResultsForTesting("stub_ethernet", state);
468
469 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
470 detector->SetDetectionResultsForTesting("stub_wifi1", state);
471
472 state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
473 detector->SetDetectionResultsForTesting("stub_wifi2", state);
474
475 state.status =
476 NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
477 detector->SetDetectionResultsForTesting("stub_cellular1", state);
478
479 EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_;
480 }
481 #endif
482
455 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation, 483 INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation,
456 ExtensionNetworkingPrivateApiTest, 484 ExtensionNetworkingPrivateApiTest,
457 testing::Bool()); 485 testing::Bool());
458 486
459 } // namespace 487 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698