Index: chrome/test/data/extensions/api_test/networking_private/chromeos/test.js |
diff --git a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js |
index 69afe31a17e2fa17a34876cb1c332f9c647dbaac..876fb3445c884abdaa415289bb7162ce5022f1aa 100644 |
--- a/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js |
+++ b/chrome/test/data/extensions/api_test/networking_private/chromeos/test.js |
@@ -11,16 +11,20 @@ var assertTrue = chrome.test.assertTrue; |
var assertFalse = chrome.test.assertFalse; |
var assertEq = chrome.test.assertEq; |
+var ActivationStateType = chrome.networkingPrivate.ActivationStateType; |
+var ConnectionStateType = chrome.networkingPrivate.ConnectionStateType; |
+var NetworkType = chrome.networkingPrivate.NetworkType; |
+ |
// Test properties for the verification API. |
var verificationProperties = { |
- "certificate": "certificate", |
- "intermediateCertificates": ["ica1", "ica2", "ica3"], |
- "publicKey": "cHVibGljX2tleQ==", // Base64("public_key") |
- "nonce": "nonce", |
- "signedData": "c2lnbmVkX2RhdGE=", // Base64("signed_data") |
- "deviceSerial": "device_serial", |
- "deviceSsid": "Device 0123", |
- "deviceBssid": "00:01:02:03:04:05" |
+ certificate: 'certificate', |
+ intermediateCertificates: ['ica1', 'ica2', 'ica3'], |
+ publicKey: 'cHVibGljX2tleQ==', // Base64('public_key') |
+ nonce: 'nonce', |
+ signedData: 'c2lnbmVkX2RhdGE=', // Base64('signed_data') |
+ deviceSerial: 'device_serial', |
+ deviceSsid: 'Device 0123', |
+ deviceBssid: '00:01:02:03:04:05' |
}; |
var privateHelpers = { |
@@ -78,70 +82,70 @@ var privateHelpers = { |
var availableTests = [ |
function startConnect() { |
- chrome.networkingPrivate.startConnect("stub_wifi2_guid", callbackPass()); |
+ chrome.networkingPrivate.startConnect('stub_wifi2_guid', callbackPass()); |
}, |
function startDisconnect() { |
// Must connect to a network before we can disconnect from it. |
chrome.networkingPrivate.startConnect( |
- "stub_wifi2_guid", callbackPass(function() { |
- chrome.networkingPrivate.startDisconnect("stub_wifi2_guid", |
+ 'stub_wifi2_guid', callbackPass(function() { |
+ chrome.networkingPrivate.startDisconnect('stub_wifi2_guid', |
callbackPass()); |
})); |
}, |
function startActivate() { |
// Must connect to a network before we can activate it. |
chrome.networkingPrivate.startConnect( |
- "stub_cellular1_guid", callbackPass(function() { |
+ 'stub_cellular1_guid', callbackPass(function() { |
chrome.networkingPrivate.startActivate( |
- "stub_cellular1_guid", callbackPass(function() { |
- chrome.networkingPrivate.getState( |
- "stub_cellular1_guid", callbackPass(function(state) { |
- assertEq("Activated", state.Cellular.ActivationState); |
+ 'stub_cellular1_guid', callbackPass(function() { |
+ chrome.networkingPrivate.getState( |
+ 'stub_cellular1_guid', callbackPass(function(state) { |
+ assertEq(ActivationStateType.Activated, |
+ state.Cellular.ActivationState); |
+ })); |
})); |
- })); |
})); |
}, |
function startConnectNonexistent() { |
chrome.networkingPrivate.startConnect( |
- "nonexistent_path", |
- callbackFail("Error.InvalidNetworkGuid")); |
+ 'nonexistent_path', |
+ callbackFail('Error.InvalidNetworkGuid')); |
}, |
function startDisconnectNonexistent() { |
chrome.networkingPrivate.startDisconnect( |
- "nonexistent_path", |
- callbackFail("Error.InvalidNetworkGuid")); |
+ 'nonexistent_path', |
+ callbackFail('Error.InvalidNetworkGuid')); |
}, |
function startGetPropertiesNonexistent() { |
chrome.networkingPrivate.getProperties( |
- "nonexistent_path", |
- callbackFail("Error.InvalidNetworkGuid")); |
+ 'nonexistent_path', |
+ callbackFail('Error.InvalidNetworkGuid')); |
}, |
function createNetwork() { |
chrome.networkingPrivate.createNetwork( |
false, // shared |
- { "Type": "WiFi", |
- "GUID": "ignored_guid", |
- "WiFi": { |
- "SSID": "wifi_created", |
- "Security": "WEP-PSK" |
+ { Type: NetworkType.WiFi, |
+ GUID: 'ignored_guid', |
+ WiFi: { |
+ SSID: 'wifi_created', |
+ Security: 'WEP-PSK' |
} |
}, |
callbackPass(function(guid) { |
- assertFalse(guid == ""); |
- assertFalse(guid == "ignored_guid"); |
+ assertFalse(guid == ''); |
+ assertFalse(guid == 'ignored_guid'); |
chrome.networkingPrivate.getProperties( |
- guid, |
- callbackPass(function(properties) { |
- assertEq("WiFi", properties.Type); |
- assertEq(guid, properties.GUID); |
- assertEq("wifi_created", properties.WiFi.SSID); |
- assertEq("WEP-PSK", properties.WiFi.Security); |
- })); |
+ guid, callbackPass(function(properties) { |
+ assertEq(NetworkType.WiFi, properties.Type); |
+ assertEq(guid, properties.GUID); |
+ assertEq('wifi_created', properties.WiFi.SSID); |
+ assertEq('WEP-PSK', properties.WiFi.Security); |
+ })); |
})); |
}, |
function forgetNetwork() { |
var kNumNetworks = 2; |
- var kTestNetworkGuid = "stub_wifi1_guid"; |
+ var kTestNetworkGuid = 'stub_wifi1_guid'; |
function guidExists(networks, guid) { |
for (var n of networks) { |
if (n.GUID == kTestNetworkGuid) |
@@ -149,78 +153,90 @@ var availableTests = [ |
} |
return false; |
} |
+ var filter = { |
+ networkType: NetworkType.WiFi, |
+ visible: true, |
+ configured: true |
+ }; |
chrome.networkingPrivate.getNetworks( |
- { "networkType": "WiFi", "visible": true, "configured": true }, |
- callbackPass(function(networks) { |
- assertEq(kNumNetworks, networks.length); |
- assertTrue(guidExists(networks, kTestNetworkGuid)); |
- chrome.networkingPrivate.forgetNetwork( |
- kTestNetworkGuid, callbackPass(function() { |
- chrome.networkingPrivate.getNetworks( |
- { "networkType": "WiFi", "visible": true, "configured": true }, |
- callbackPass(function(networks) { |
- assertEq(kNumNetworks - 1, networks.length); |
- assertFalse(guidExists(networks, kTestNetworkGuid)); |
+ filter, callbackPass(function(networks) { |
+ assertEq(kNumNetworks, networks.length); |
+ assertTrue(guidExists(networks, kTestNetworkGuid)); |
+ chrome.networkingPrivate.forgetNetwork( |
+ kTestNetworkGuid, callbackPass(function() { |
+ chrome.networkingPrivate.getNetworks( |
+ filter, callbackPass(function(networks) { |
+ assertEq(kNumNetworks - 1, networks.length); |
+ assertFalse(guidExists(networks, kTestNetworkGuid)); |
+ })); |
})); |
- })); |
- })); |
+ })); |
}, |
function getNetworks() { |
// Test 'type' and 'configured'. |
+ var filter = { |
+ networkType: NetworkType.WiFi, |
+ configured: true |
+ }; |
chrome.networkingPrivate.getNetworks( |
- { "networkType": "WiFi", "configured": true }, |
+ filter, |
callbackPass(function(result) { |
assertEq([{ |
- "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wifi1_guid", |
- "Name": "wifi1", |
- "Type": "WiFi", |
- "Source":"User", |
- "WiFi": { |
- "Security": "WEP-PSK", |
- "SignalStrength": 40 |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wifi1_guid', |
+ Name: 'wifi1', |
+ Type: NetworkType.WiFi, |
+ Source: 'User', |
+ WiFi: { |
+ Security: 'WEP-PSK', |
+ SignalStrength: 40 |
} |
}, { |
- "GUID": "stub_wifi2_guid", |
- "Name": "wifi2_PSK", |
- "Type": "WiFi", |
- "Source":"User", |
- "WiFi": { |
- "Security": "WPA-PSK", |
+ GUID: 'stub_wifi2_guid', |
+ Name: 'wifi2_PSK', |
+ Type: NetworkType.WiFi, |
+ Source: 'User', |
+ WiFi: { |
+ Security: 'WPA-PSK', |
} |
}], result); |
// Test 'visible' (and 'configured'). |
+ filter.visible = true; |
chrome.networkingPrivate.getNetworks( |
- { "networkType": "WiFi", "visible": true, "configured": true }, |
+ filter, |
callbackPass(function(result) { |
assertEq([{ |
- "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wifi1_guid", |
- "Name": "wifi1", |
- "Source":"User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WEP-PSK", |
- "SignalStrength": 40 |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wifi1_guid', |
+ Name: 'wifi1', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WEP-PSK', |
+ SignalStrength: 40 |
} |
}], result); |
// Test 'limit'. |
+ filter = { |
+ networkType: NetworkType.All, |
+ limit: 1 |
+ }; |
chrome.networkingPrivate.getNetworks( |
- { "networkType": "All", "limit": 1 }, |
+ filter, |
callbackPass(function(result) { |
assertEq([{ |
- "ConnectionState": "Connected", |
- "Ethernet": { |
- "Authentication": "None" |
+ ConnectionState: ConnectionStateType.Connected, |
+ Ethernet: { |
+ Authentication: 'None' |
}, |
- "GUID": "stub_ethernet_guid", |
- "Name": "eth0", |
- "Source":"Device", |
- "Type": "Ethernet" |
+ GUID: 'stub_ethernet_guid', |
+ Name: 'eth0', |
+ Source: 'Device', |
+ Type: NetworkType.Ethernet |
}], result); |
})); |
})); |
@@ -228,117 +244,110 @@ var availableTests = [ |
}, |
function getVisibleNetworks() { |
chrome.networkingPrivate.getVisibleNetworks( |
- "All", |
+ NetworkType.All, |
callbackPass(function(result) { |
assertEq([{ |
- "ConnectionState": "Connected", |
- "Ethernet": { |
- "Authentication": "None" |
- }, |
- "GUID": "stub_ethernet_guid", |
- "Name": "eth0", |
- "Source":"Device", |
- "Type": "Ethernet" |
- }, |
- { |
- "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wifi1_guid", |
- "Name": "wifi1", |
- "Source": "User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WEP-PSK", |
- "SignalStrength": 40 |
- } |
- }, |
- { |
- "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wimax_guid", |
- "Name": "wimax", |
- "Source": "User", |
- "Type": "WiMAX", |
- "WiMAX": { |
- "SignalStrength": 40 |
- } |
- }, |
- { |
- "ConnectionState": "Connected", |
- "GUID": "stub_vpn1_guid", |
- "Name": "vpn1", |
- "Source": "User", |
- "Type": "VPN", |
- "VPN": { |
- "Type":"OpenVPN" |
- } |
- }, |
- { |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_vpn2_guid", |
- "Name": "vpn2", |
- "Source": "User", |
- "Type": "VPN", |
- "VPN": { |
- "ThirdPartyVPN": { |
- "ExtensionID": "third_party_provider_extension_id" |
- }, |
- "Type": "ThirdPartyVPN" |
- } |
- }, |
- { |
- "Connectable": true, |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_wifi2_guid", |
- "Name": "wifi2_PSK", |
- "Source": "User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WPA-PSK", |
- "SignalStrength": 80 |
- } |
- }], result); |
+ ConnectionState: ConnectionStateType.Connected, |
+ Ethernet: { |
+ Authentication: 'None' |
+ }, |
+ GUID: 'stub_ethernet_guid', |
+ Name: 'eth0', |
+ Source: 'Device', |
+ Type: NetworkType.Ethernet |
+ }, { |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wifi1_guid', |
+ Name: 'wifi1', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WEP-PSK', |
+ SignalStrength: 40 |
+ } |
+ }, { |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wimax_guid', |
+ Name: 'wimax', |
+ Source: 'User', |
+ Type: NetworkType.WiMAX, |
+ WiMAX: { |
+ SignalStrength: 40 |
+ } |
+ }, { |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_vpn1_guid', |
+ Name: 'vpn1', |
+ Source: 'User', |
+ Type: NetworkType.VPN, |
+ VPN: { |
+ Type: 'OpenVPN' |
+ } |
+ }, { |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_vpn2_guid', |
+ Name: 'vpn2', |
+ Source: 'User', |
+ Type: NetworkType.VPN, |
+ VPN: { |
+ ThirdPartyVPN: { |
+ ExtensionID: 'third_party_provider_extension_id' |
+ }, |
+ Type: 'ThirdPartyVPN' |
+ } |
+ }, { |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_wifi2_guid', |
+ Name: 'wifi2_PSK', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WPA-PSK', |
+ SignalStrength: 80 |
+ } |
+ }], result); |
})); |
}, |
function getVisibleNetworksWifi() { |
chrome.networkingPrivate.getVisibleNetworks( |
- "WiFi", |
+ NetworkType.WiFi, |
callbackPass(function(result) { |
assertEq([{ |
- "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wifi1_guid", |
- "Name": "wifi1", |
- "Source": "User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WEP-PSK", |
- "SignalStrength": 40 |
- } |
- }, |
- { |
- "Connectable": true, |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_wifi2_guid", |
- "Name": "wifi2_PSK", |
- "Source": "User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WPA-PSK", |
- "SignalStrength": 80 |
- } |
- } |
- ], result); |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wifi1_guid', |
+ Name: 'wifi1', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WEP-PSK', |
+ SignalStrength: 40 |
+ } |
+ }, { |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_wifi2_guid', |
+ Name: 'wifi2_PSK', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WPA-PSK', |
+ SignalStrength: 80 |
+ } |
+ }], result); |
})); |
}, |
function requestNetworkScan() { |
// Connected or Connecting networks should be listed first, sorted by type. |
- var expected = ["stub_ethernet_guid", |
- "stub_wifi1_guid", |
- "stub_wimax_guid", |
- "stub_vpn1_guid", |
- "stub_vpn2_guid", |
- "stub_wifi2_guid"]; |
+ var expected = ['stub_ethernet_guid', |
+ 'stub_wifi1_guid', |
+ 'stub_wimax_guid', |
+ 'stub_vpn1_guid', |
+ 'stub_vpn2_guid', |
+ 'stub_wifi2_guid']; |
var done = chrome.test.callbackAdded(); |
var listener = new privateHelpers.listListener(expected, done); |
chrome.networkingPrivate.onNetworkListChanged.addListener( |
@@ -347,112 +356,114 @@ var availableTests = [ |
}, |
function getProperties() { |
chrome.networkingPrivate.getProperties( |
- "stub_wifi1_guid", |
+ 'stub_wifi1_guid', |
callbackPass(function(result) { |
- assertEq({ "Connectable": true, |
- "ConnectionState": "Connected", |
- "GUID": "stub_wifi1_guid", |
- "IPAddressConfigType": "Static", |
- "IPConfigs": [{ |
- "Gateway": "0.0.0.1", |
- "IPAddress": "0.0.0.0", |
- "RoutingPrefix": 0, |
- "Type": "IPv4" |
- }], |
- "MacAddress": "00:11:22:AA:BB:CC", |
- "Name": "wifi1", |
- "StaticIPConfig": { |
- "IPAddress": "1.2.3.4", |
- "Type": "IPv4" |
- }, |
- "Type": "WiFi", |
- "WiFi": { |
- "HexSSID": "7769666931", // "wifi1" |
- "Frequency": 2400, |
- "FrequencyList": [2400], |
- "SSID": "wifi1", |
- "Security": "WEP-PSK", |
- "SignalStrength": 40 |
- } |
- }, result); |
+ assertEq({ |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.Connected, |
+ GUID: 'stub_wifi1_guid', |
+ IPAddressConfigType: chrome.networkingPrivate.IPConfigType.Static, |
+ IPConfigs: [{ |
+ Gateway: '0.0.0.1', |
+ IPAddress: '0.0.0.0', |
+ RoutingPrefix: 0, |
+ Type: 'IPv4' |
+ }], |
+ MacAddress: '00:11:22:AA:BB:CC', |
+ Name: 'wifi1', |
+ StaticIPConfig: { |
+ IPAddress: '1.2.3.4', |
+ Type: 'IPv4' |
+ }, |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ HexSSID: '7769666931', // 'wifi1' |
+ Frequency: 2400, |
+ FrequencyList: [2400], |
+ SSID: 'wifi1', |
+ Security: 'WEP-PSK', |
+ SignalStrength: 40 |
+ } |
+ }, result); |
})); |
}, |
function getPropertiesCellular() { |
chrome.networkingPrivate.getProperties( |
- "stub_cellular1_guid", |
+ 'stub_cellular1_guid', |
callbackPass(function(result) { |
- assertEq({ "Cellular": { |
- "ActivationState": "NotActivated", |
- "AllowRoaming": false, |
- "AutoConnect": true, |
- "Carrier": "Cellular1_Carrier", |
- "HomeProvider": { |
- "Country": "us", |
- "Name": "Cellular1_Provider" |
- }, |
- "NetworkTechnology": "GSM", |
- "RoamingState": "Home" |
- }, |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_cellular1_guid", |
- "Name": "cellular1", |
- "Type": "Cellular" |
- }, result); |
+ assertEq({ |
+ Cellular: { |
+ ActivationState: ActivationStateType.NotActivated, |
+ AllowRoaming: false, |
+ AutoConnect: true, |
+ Carrier: 'Cellular1_Carrier', |
+ HomeProvider: { |
+ Country: 'us', |
+ Name: 'Cellular1_Provider' |
+ }, |
+ NetworkTechnology: 'GSM', |
+ RoamingState: 'Home' |
+ }, |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_cellular1_guid', |
+ Name: 'cellular1', |
+ Type: NetworkType.Cellular, |
+ }, result); |
})); |
}, |
function getManagedProperties() { |
chrome.networkingPrivate.getManagedProperties( |
- "stub_wifi2", |
+ 'stub_wifi2', |
callbackPass(function(result) { |
assertEq({ |
- "Connectable": true, |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_wifi2", |
- "Name": { |
- "Active": "wifi2_PSK", |
- "Effective": "UserPolicy", |
- "UserPolicy": "My WiFi Network" |
- }, |
- "Source": "UserPolicy", |
- "Type": { |
- "Active": "WiFi", |
- "Effective": "UserPolicy", |
- "UserPolicy": "WiFi" |
- }, |
- "WiFi": { |
- "AutoConnect": { |
- "Active": false, |
- "UserEditable": true |
- }, |
- "HexSSID": { |
- "Active": "77696669325F50534B", // "wifi2_PSK" |
- "Effective": "UserPolicy", |
- "UserPolicy": "77696669325F50534B" |
- }, |
- "Frequency" : 5000, |
- "FrequencyList" : [2400, 5000], |
- "Passphrase": { |
- "Effective": "UserSetting", |
- "UserEditable": true, |
- "UserSetting": "FAKE_CREDENTIAL_VPaJDV9x" |
- }, |
- "SSID": { |
- "Active": "wifi2_PSK", |
- "Effective": "UserPolicy", |
- }, |
- "Security": { |
- "Active": "WPA-PSK", |
- "Effective": "UserPolicy", |
- "UserPolicy": "WPA-PSK" |
- }, |
- "SignalStrength": 80, |
- } |
- }, result); |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_wifi2', |
+ Name: { |
+ Active: 'wifi2_PSK', |
+ Effective: 'UserPolicy', |
+ UserPolicy: 'My WiFi Network' |
+ }, |
+ Source: 'UserPolicy', |
+ Type: { |
+ Active: NetworkType.WiFi, |
+ Effective: 'UserPolicy', |
+ UserPolicy: NetworkType.WiFi |
+ }, |
+ WiFi: { |
+ AutoConnect: { |
+ Active: false, |
+ UserEditable: true |
+ }, |
+ HexSSID: { |
+ Active: '77696669325F50534B', // 'wifi2_PSK' |
+ Effective: 'UserPolicy', |
+ UserPolicy: '77696669325F50534B' |
+ }, |
+ Frequency: 5000, |
+ FrequencyList: [2400, 5000], |
+ Passphrase: { |
+ Effective: 'UserSetting', |
+ UserEditable: true, |
+ UserSetting: 'FAKE_CREDENTIAL_VPaJDV9x' |
+ }, |
+ SSID: { |
+ Active: 'wifi2_PSK', |
+ Effective: 'UserPolicy', |
+ }, |
+ Security: { |
+ Active: 'WPA-PSK', |
+ Effective: 'UserPolicy', |
+ UserPolicy: 'WPA-PSK' |
+ }, |
+ SignalStrength: 80, |
+ } |
+ }, result); |
})); |
}, |
function setWiFiProperties() { |
var done = chrome.test.callbackAdded(); |
- var network_guid = "stub_wifi1_guid"; |
+ var network_guid = 'stub_wifi1_guid'; |
chrome.networkingPrivate.getProperties( |
network_guid, |
callbackPass(function(result) { |
@@ -491,7 +502,7 @@ var availableTests = [ |
}, |
function setVPNProperties() { |
var done = chrome.test.callbackAdded(); |
- var network_guid = "stub_vpn1_guid"; |
+ var network_guid = 'stub_vpn1_guid'; |
chrome.networkingPrivate.getProperties( |
network_guid, |
callbackPass(function(result) { |
@@ -523,18 +534,18 @@ var availableTests = [ |
}, |
function getState() { |
chrome.networkingPrivate.getState( |
- "stub_wifi2_guid", |
+ 'stub_wifi2_guid', |
callbackPass(function(result) { |
assertEq({ |
- "Connectable": true, |
- "ConnectionState": "NotConnected", |
- "GUID": "stub_wifi2_guid", |
- "Name": "wifi2_PSK", |
- "Source": "User", |
- "Type": "WiFi", |
- "WiFi": { |
- "Security": "WPA-PSK", |
- "SignalStrength": 80 |
+ Connectable: true, |
+ ConnectionState: ConnectionStateType.NotConnected, |
+ GUID: 'stub_wifi2_guid', |
+ Name: 'wifi2_PSK', |
+ Source: 'User', |
+ Type: NetworkType.WiFi, |
+ WiFi: { |
+ Security: 'WPA-PSK', |
+ SignalStrength: 80 |
} |
}, result); |
})); |
@@ -545,17 +556,17 @@ var availableTests = [ |
callbackFail('Error.InvalidNetworkGuid')); |
}, |
function onNetworksChangedEventConnect() { |
- var network = "stub_wifi2_guid"; |
+ var network = 'stub_wifi2_guid'; |
var done = chrome.test.callbackAdded(); |
- var expectedStates = ["Connected"]; |
+ var expectedStates = [ConnectionStateType.Connected]; |
var listener = |
new privateHelpers.watchForStateChanges(network, expectedStates, done); |
chrome.networkingPrivate.startConnect(network, callbackPass()); |
}, |
function onNetworksChangedEventDisconnect() { |
- var network = "stub_wifi1_guid"; |
+ var network = 'stub_wifi1_guid'; |
var done = chrome.test.callbackAdded(); |
- var expectedStates = ["NotConnected"]; |
+ var expectedStates = [ConnectionStateType.NotConnected]; |
var listener = |
new privateHelpers.watchForStateChanges(network, expectedStates, done); |
chrome.networkingPrivate.startDisconnect(network, callbackPass()); |
@@ -563,17 +574,17 @@ var availableTests = [ |
function onNetworkListChangedEvent() { |
// Connecting to wifi2 should set wifi1 to offline. Connected or Connecting |
// networks should be listed first, sorted by type. |
- var expected = ["stub_ethernet_guid", |
- "stub_wifi2_guid", |
- "stub_wimax_guid", |
- "stub_vpn1_guid", |
- "stub_wifi1_guid", |
- "stub_vpn2_guid"]; |
+ var expected = ['stub_ethernet_guid', |
+ 'stub_wifi2_guid', |
+ 'stub_wimax_guid', |
+ 'stub_vpn1_guid', |
+ 'stub_wifi1_guid', |
+ 'stub_vpn2_guid']; |
var done = chrome.test.callbackAdded(); |
var listener = new privateHelpers.listListener(expected, done); |
chrome.networkingPrivate.onNetworkListChanged.addListener( |
listener.listenForChanges); |
- var network = "stub_wifi2_guid"; |
+ var network = 'stub_wifi2_guid'; |
chrome.networkingPrivate.startConnect(network, callbackPass()); |
}, |
function verifyDestination() { |
@@ -584,36 +595,33 @@ var availableTests = [ |
})); |
}, |
function verifyAndEncryptCredentials() { |
- var network_guid = "stub_wifi2_guid"; |
+ var network_guid = 'stub_wifi2_guid'; |
chrome.networkingPrivate.verifyAndEncryptCredentials( |
verificationProperties, |
network_guid, |
callbackPass(function(result) { |
- assertEq("encrypted_credentials", result); |
+ assertEq('encrypted_credentials', result); |
})); |
}, |
function verifyAndEncryptData() { |
chrome.networkingPrivate.verifyAndEncryptData( |
verificationProperties, |
- "data", |
+ 'data', |
callbackPass(function(result) { |
- assertEq("encrypted_data", result); |
+ assertEq('encrypted_data', result); |
})); |
}, |
function setWifiTDLSEnabledState() { |
chrome.networkingPrivate.setWifiTDLSEnabledState( |
- "aa:bb:cc:dd:ee:ff", |
- true, |
- callbackPass(function(result) { |
- assertEq("Connected", result); |
- })); |
+ 'aa:bb:cc:dd:ee:ff', true, callbackPass(function(result) { |
+ assertEq(ConnectionStateType.Connected, result); |
+ })); |
}, |
function getWifiTDLSStatus() { |
chrome.networkingPrivate.getWifiTDLSStatus( |
- "aa:bb:cc:dd:ee:ff", |
- callbackPass(function(result) { |
- assertEq("Connected", result); |
- })); |
+ 'aa:bb:cc:dd:ee:ff', callbackPass(function(result) { |
+ assertEq(ConnectionStateType.Connected, result); |
+ })); |
}, |
function getCaptivePortalStatus() { |
var networks = [['stub_ethernet_guid', 'Online'], |