OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 var callbackPass = chrome.test.callbackPass; | 5 var callbackPass = chrome.test.callbackPass; |
6 var callbackFail = chrome.test.callbackFail; | 6 var callbackFail = chrome.test.callbackFail; |
7 var assertTrue = chrome.test.assertTrue; | 7 var assertTrue = chrome.test.assertTrue; |
8 var assertEq = chrome.test.assertEq; | 8 var assertEq = chrome.test.assertEq; |
9 | 9 |
10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 function getProperties() { | 73 function getProperties() { |
74 chrome.networkingPrivate.getProperties( | 74 chrome.networkingPrivate.getProperties( |
75 "stub_wifi2", | 75 "stub_wifi2", |
76 callbackPass(function(result) { | 76 callbackPass(function(result) { |
77 assertTrue(!!result); | 77 assertTrue(!!result); |
78 assertEq("wifi2_PSK", result.Name); | 78 assertEq("wifi2_PSK", result.Name); |
79 assertEq("NotConnected", result.ConnectionState); | 79 assertEq("NotConnected", result.ConnectionState); |
80 assertEq("WiFi", result.Type); | 80 assertEq("WiFi", result.Type); |
81 })); | 81 })); |
82 }, | 82 }, |
83 function propertiesChangeEvent() { | |
84 chrome.networkingPrivate.onNetworkChanged.addListener( | |
85 function (properties) { | |
86 assertEq( | |
87 [ | |
88 { | |
89 "ConnectionState": "Connected", | |
90 "GUID": "stub_ethernet", | |
91 "Name": "eth0", | |
92 "Type": "Ethernet" | |
93 }, | |
94 { | |
95 "ConnectionState": "Connecting", | |
96 "GUID": "stub_wifi1", | |
97 "Name": "wifi1", | |
98 "Type": "WiFi" | |
99 }, | |
100 { | |
101 "ConnectionState": "NotConnected", | |
102 "GUID": "stub_wifi2", | |
103 "Name": "wifi2_PSK", | |
104 "Type": "WiFi" | |
105 }, | |
106 { | |
107 "ConnectionState": "NotConnected", | |
108 "GUID": "stub_cellular1", | |
109 "Name": "cellular1", | |
110 "Type": "Cellular" | |
111 } | |
112 ], properties); | |
113 }); | |
not at google - send to devlin
2013/02/05 21:43:20
The event might (probably will) come in before the
Greg Spencer (Chromium)
2013/02/05 22:36:35
Thanks, I was wondering how to do that. Done.
| |
114 chrome.networkingPrivate.startConnect("stub_wifi1", | |
115 callbackPass(function() {})); | |
116 }, | |
83 function startConnect() { | 117 function startConnect() { |
84 chrome.networkingPrivate.startConnect("stub_wifi2", | 118 chrome.networkingPrivate.startConnect("stub_wifi2", |
85 callbackPass(function() {})); | 119 callbackPass(function() {})); |
86 }, | 120 }, |
87 function startDisconnect() { | 121 function startDisconnect() { |
88 chrome.networkingPrivate.startDisconnect("stub_wifi2", | 122 chrome.networkingPrivate.startDisconnect("stub_wifi2", |
89 callbackPass(function() {})); | 123 callbackPass(function() {})); |
90 }, | 124 }, |
91 function startConnectNonexistent() { | 125 function startConnectNonexistent() { |
92 // Make sure we get an error when we try to connect to a nonexistent | 126 // Make sure we get an error when we try to connect to a nonexistent |
93 // network. | 127 // network. |
94 chrome.networkingPrivate.startConnect( | 128 chrome.networkingPrivate.startConnect( |
95 "nonexistent_path", | 129 "nonexistent_path", |
96 callbackFail("Error.InvalidService", function() {})); | 130 callbackFail("Error.InvalidService", function() {})); |
97 } | 131 } |
98 ]); | 132 ]); |
OLD | NEW |