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

Unified Diff: chrome/test/data/extensions/api_test/networking/test.js

Issue 11975015: This adds a private extension API to use for simple networking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload after another merge Created 7 years, 10 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/test/data/extensions/api_test/networking/test.js
diff --git a/chrome/test/data/extensions/api_test/networking/test.js b/chrome/test/data/extensions/api_test/networking/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..5503ced293932998012d9546437436cd5d410326
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/networking/test.js
@@ -0,0 +1,98 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var callbackPass = chrome.test.callbackPass;
+var callbackFail = chrome.test.callbackFail;
+var assertTrue = chrome.test.assertTrue;
+var assertEq = chrome.test.assertEq;
+
+chrome.test.runTests([
+ function getVisibleNetworks() {
+ chrome.networkingPrivate.getVisibleNetworks(
+ "All",
+ callbackPass(function(result) {
+ assertTrue(!!result);
+ assertEq(4, result.length);
+ assertEq([{ "Name": "eth0",
+ "GUID": "stub_ethernet",
+ "ConnectionState": "Connected",
+ "Type": "Ethernet"
+ },
+ { "Name": "wifi1",
+ "GUID": "stub_wifi1",
+ "ConnectionState": "Connected",
+ "Type": "WiFi",
+ "WiFi": {
+ "SSID": "stub_wifi1",
+ "Type": "WiFi"
+ }
+ },
+ { "Name": "wifi2_PSK",
+ "GUID": "stub_wifi2",
+ "ConnectionState": "NotConnected",
+ "Type": "WiFi",
+ "WiFi": {
+ "SSID": "stub_wifi2",
+ "Type": "WiFi"
+ }
+ },
+ { "Name": "cellular1",
+ "GUID": "stub_cellular1",
+ "ConnectionState": "NotConnected",
+ "Type": "Cellular"
+ }], result);
+ }));
+ },
+ function getVisibleNetworksWifi() {
+ chrome.networkingPrivate.getVisibleNetworks(
+ "WiFi",
+ callbackPass(function(result) {
+ assertTrue(!!result);
+ assertEq(2, result.length);
+ assertEq([{ "Name": "wifi1",
+ "GUID": "stub_wifi1",
+ "ConnectionState": "Connected",
+ "Type": "WiFi",
+ "WiFi": {
+ "SSID": "stub_wifi1",
+ "Type":"WiFi"
+ }
+ },
+ { "Name": "wifi2_PSK",
+ "GUID": "stub_wifi2",
+ "ConnectionState": "NotConnected",
+ "Type": "WiFi",
+ "WiFi": {
+ "SSID": "stub_wifi2",
+ "Type": "WiFi"
+ }
+ }], result);
+ }));
+ },
+ function getProperties() {
+ chrome.networkingPrivate.getProperties(
+ "stub_wifi2",
+ callbackPass(function(result) {
+ assertTrue(!!result);
+ assertEq("wifi2_PSK", result.Name);
+ assertEq("NotConnected", result.ConnectionState);
+ assertEq("WiFi", result.Type);
+ }));
+ },
+ function startConnect() {
+ chrome.networkingPrivate.startConnect("stub_wifi2",
+ callbackPass(function() {}));
+ },
+ function startDisconnect() {
+ chrome.networkingPrivate.startDisconnect("stub_wifi2",
+ callbackPass(function() {}));
+ },
+ function startConnectNonexistent() {
+ // Make sure we get an error when we try to connect to a nonexistent
+ // network.
+ chrome.networkingPrivate.startConnect(
+ "nonexistent_path",
+ callbackFail("Error.InvalidService", function() {}));
+ }
+]);
« no previous file with comments | « chrome/test/data/extensions/api_test/networking/manifest.json ('k') | chromeos/dbus/shill_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698