OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 var EXTENSION_ID = chrome.runtime.id; | |
not at google - send to devlin
2013/02/02 00:11:32
this alias doesn't seem like it's saving much
als
Greg Spencer (Chromium)
2013/02/02 01:06:15
Removed.
| |
6 var FILE_CONTENTS = 'hello from test extension.'; | |
not at google - send to devlin
2013/02/02 00:11:32
neither is this
Greg Spencer (Chromium)
2013/02/02 01:06:15
Removed.
| |
7 var callbackPass = chrome.test.callbackPass; | |
8 var callbackFail = chrome.test.callbackFail; | |
9 var assertTrue = chrome.test.assertTrue; | |
10 var assertEq = chrome.test.assertEq; | |
11 | |
12 chrome.test.runTests([ | |
13 function getVisibleNetworks() { | |
14 chrome.networkingPrivate.getVisibleNetworks( | |
15 "All", | |
16 callbackPass(function(result) { | |
17 assertTrue(!!result); | |
18 assertEq(4, result.length); | |
19 assertEq([{ "Name": "eth0", | |
20 "GUID": "stub_ethernet", | |
21 "ConnectionState": "Connected", | |
22 "Type": "Ethernet" | |
23 }, | |
24 { "Name": "wifi1", | |
25 "GUID": "stub_wifi1", | |
26 "ConnectionState": "Connected", | |
27 "Type": "WiFi", | |
28 "WiFi": { | |
29 "SSID": "stub_wifi1", | |
30 "Type": "WiFi" | |
31 } | |
32 }, | |
33 { "Name": "wifi2_PSK", | |
34 "GUID": "stub_wifi2", | |
35 "ConnectionState": "NotConnected", | |
36 "Type": "WiFi", | |
37 "WiFi": { | |
38 "SSID": "stub_wifi2", | |
39 "Type": "WiFi" | |
40 } | |
41 }, | |
42 { "Name": "cellular1", | |
43 "GUID": "stub_cellular1", | |
44 "ConnectionState": "NotConnected", | |
45 "Type": "Cellular" | |
46 }], result); | |
47 })); | |
48 }, | |
49 function getVisibleNetworksWifi() { | |
50 chrome.networkingPrivate.getVisibleNetworks( | |
51 "WiFi", | |
52 callbackPass(function(result) { | |
53 assertTrue(!!result); | |
54 assertEq(2, result.length); | |
55 assertEq([{ "Name": "wifi1", | |
56 "GUID": "stub_wifi1", | |
57 "ConnectionState": "Connected", | |
58 "Type": "WiFi", | |
59 "WiFi": { | |
60 "SSID": "stub_wifi1", | |
61 "Type":"WiFi" | |
62 } | |
63 }, | |
64 { "Name": "wifi2_PSK", | |
65 "GUID": "stub_wifi2", | |
66 "ConnectionState": "NotConnected", | |
67 "Type": "WiFi", | |
68 "WiFi": { | |
69 "SSID": "stub_wifi2", | |
70 "Type": "WiFi" | |
71 } | |
72 }], result); | |
73 })); | |
74 }, | |
75 function getProperties() { | |
76 chrome.networkingPrivate.getProperties( | |
77 "stub_wifi2", | |
78 callbackPass(function(result) { | |
79 assertTrue(!!result); | |
80 assertEq("wifi2_PSK", result.Name); | |
81 assertEq("NotConnected", result.ConnectionState); | |
82 assertEq("WiFi", result.Type); | |
83 })); | |
84 }, | |
85 function startConnect() { | |
86 chrome.networkingPrivate.startConnect( | |
87 "stub_wifi2", | |
88 callbackPass(function() { | |
89 assertTrue(!chrome.runtime.lastError); | |
not at google - send to devlin
2013/02/02 00:11:32
not necessary
Greg Spencer (Chromium)
2013/02/02 01:06:15
Done.
| |
90 })); | |
91 }, | |
92 function startDisconnect() { | |
93 chrome.networkingPrivate.startDisconnect( | |
94 "stub_wifi2", | |
95 callbackPass(function() { | |
96 assertTrue(!chrome.runtime.lastError); | |
not at google - send to devlin
2013/02/02 00:11:32
not necessary
Greg Spencer (Chromium)
2013/02/02 01:06:15
Done.
| |
97 })); | |
98 }, | |
99 function startConnectNonexistent() { | |
100 // Make sure we get an error when we try to connect to a nonexistent | |
101 // network. | |
102 chrome.networkingPrivate.startConnect( | |
103 "nonexistent_path", | |
104 callbackFail("Error.InvalidService", function() {})); | |
105 } | |
106 ]); | |
OLD | NEW |