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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
index 45adfafe32ead07a6b01a6e2741ba12d4839c34f..436ec8db6576da9d55386c44ce4f6c4f5ac88f8a 100644
--- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
+++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -14,6 +14,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/net/network_portal_detector.h"
+#include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
@@ -45,6 +47,8 @@ using chromeos::CryptohomeClient;
using chromeos::DBUS_METHOD_CALL_SUCCESS;
using chromeos::DBusMethodCallStatus;
using chromeos::DBusThreadManager;
+using chromeos::NetworkPortalDetector;
+using chromeos::NetworkPortalDetectorTestImpl;
using chromeos::ShillDeviceClient;
using chromeos::ShillManagerClient;
using chromeos::ShillProfileClient;
@@ -455,6 +459,30 @@ IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
}
#endif
+// NetworkPortalDetector is only enabled for Chrome OS.
+#if defined(OS_CHROMEOS)
+IN_PROC_BROWSER_TEST_P(ExtensionNetworkingPrivateApiTest,
+ GetCaptivePortalStatus) {
+ NetworkPortalDetectorTestImpl* detector = new NetworkPortalDetectorTestImpl();
+ NetworkPortalDetector::InitializeForTesting(detector);
+ NetworkPortalDetector::CaptivePortalState state;
+ state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE;
+ detector->SetDetectionResultsForTesting("stub_ethernet", state);
+
+ state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
+ detector->SetDetectionResultsForTesting("stub_wifi1", state);
+
+ state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL;
+ detector->SetDetectionResultsForTesting("stub_wifi2", state);
+
+ state.status =
+ NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED;
+ detector->SetDetectionResultsForTesting("stub_cellular1", state);
+
+ EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_;
+}
+#endif // defined(OS_CHROMEOS)
+
INSTANTIATE_TEST_CASE_P(ExtensionNetworkingPrivateApiTestInstantiation,
ExtensionNetworkingPrivateApiTest,
testing::Bool());

Powered by Google App Engine
This is Rietveld 408576698