| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 callbackPass = chrome.test.callbackPass; |
| 6 var callbackFail = chrome.test.callbackFail; |
| 7 var assertTrue = chrome.test.assertTrue; |
| 8 var assertEq = chrome.test.assertEq; |
| 9 |
| 10 // Test properties for the verification API. |
| 11 var verificationProperties = { |
| 12 certificate: 'certificate', |
| 13 intermediateCertificates: ['ica1', 'ica2', 'ica3'], |
| 14 publicKey: 'cHVibGljX2tleQ==', // Base64('public_key') |
| 15 nonce: 'nonce', |
| 16 signedData: 'c2lnbmVkX2RhdGE=', // Base64('signed_data') |
| 17 deviceSerial: 'device_serial', |
| 18 deviceSsid: 'Device 0123', |
| 19 deviceBssid: '00:01:02:03:04:05' |
| 20 }; |
| 21 |
| 22 chrome.test.getConfig(function(config) { |
| 23 var args = JSON.parse(config.customArg); |
| 24 |
| 25 chrome.test.runTests([ |
| 26 function verifyDestination() { |
| 27 chrome.networking.castPrivate.verifyDestination( |
| 28 verificationProperties, |
| 29 callbackPass(function(isValid) { |
| 30 assertTrue(isValid); |
| 31 })); |
| 32 }, |
| 33 function verifyAndEncryptCredentials() { |
| 34 var networkGuid = 'wifi_guid'; |
| 35 chrome.networking.castPrivate.verifyAndEncryptCredentials( |
| 36 verificationProperties, |
| 37 networkGuid, |
| 38 callbackPass(function(result) { |
| 39 assertEq('encrypted_credentials', result); |
| 40 })); |
| 41 }, |
| 42 function verifyAndEncryptData() { |
| 43 chrome.networking.castPrivate.verifyAndEncryptData( |
| 44 verificationProperties, |
| 45 'data', |
| 46 callbackPass(function(result) { |
| 47 assertEq('encrypted_data', result); |
| 48 })); |
| 49 }, |
| 50 function setWifiTDLSEnabledState() { |
| 51 if (args.tdlsSupported) { |
| 52 chrome.networking.castPrivate.setWifiTDLSEnabledState( |
| 53 'aa:bb:cc:dd:ee:ff', true, callbackPass(function(result) { |
| 54 assertEq('CONNECTED', result); |
| 55 })); |
| 56 } else { |
| 57 chrome.networking.castPrivate.setWifiTDLSEnabledState( |
| 58 'aa:bb:cc:dd:ee:ff', true, callbackFail('Not supported')); |
| 59 } |
| 60 }, |
| 61 function getWifiTDLSStatus() { |
| 62 if (args.tdlsSupported) { |
| 63 chrome.networking.castPrivate.getWifiTDLSStatus( |
| 64 'aa:bb:cc:dd:ee:ff', callbackPass(function(result) { |
| 65 assertEq('CONNECTED', result); |
| 66 })); |
| 67 } else { |
| 68 chrome.networking.castPrivate.getWifiTDLSStatus( |
| 69 'aa:bb:cc:dd:ee:ff', callbackFail('Not supported')); |
| 70 } |
| 71 }, |
| 72 ]); |
| 73 }); |
| OLD | NEW |