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

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

Issue 2726223004: Introduce networking.cast API (Closed)
Patch Set: histograms Created 3 years, 9 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_cast_private/test.js
diff --git a/chrome/test/data/extensions/api_test/networking_cast_private/test.js b/chrome/test/data/extensions/api_test/networking_cast_private/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f70b9619da28a307c85bc02a40e84256880c0c2d
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/networking_cast_private/test.js
@@ -0,0 +1,73 @@
+// Copyright 2017 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;
+
+// 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'
+};
+
+chrome.test.getConfig(function(config) {
+ var args = JSON.parse(config.customArg);
+
+ chrome.test.runTests([
+ function verifyDestination() {
+ chrome.networking.castPrivate.verifyDestination(
+ verificationProperties,
+ callbackPass(function(isValid) {
+ assertTrue(isValid);
+ }));
+ },
+ function verifyAndEncryptCredentials() {
+ var networkGuid = 'wifi_guid';
+ chrome.networking.castPrivate.verifyAndEncryptCredentials(
+ verificationProperties,
+ networkGuid,
+ callbackPass(function(result) {
+ assertEq('encrypted_credentials', result);
+ }));
+ },
+ function verifyAndEncryptData() {
+ chrome.networking.castPrivate.verifyAndEncryptData(
+ verificationProperties,
+ 'data',
+ callbackPass(function(result) {
+ assertEq('encrypted_data', result);
+ }));
+ },
+ function setWifiTDLSEnabledState() {
+ if (args.tdlsSupported) {
+ chrome.networking.castPrivate.setWifiTDLSEnabledState(
+ 'aa:bb:cc:dd:ee:ff', true, callbackPass(function(result) {
+ assertEq('CONNECTED', result);
+ }));
+ } else {
+ chrome.networking.castPrivate.setWifiTDLSEnabledState(
+ 'aa:bb:cc:dd:ee:ff', true, callbackFail('Not supported'));
+ }
+ },
+ function getWifiTDLSStatus() {
+ if (args.tdlsSupported) {
+ chrome.networking.castPrivate.getWifiTDLSStatus(
+ 'aa:bb:cc:dd:ee:ff', callbackPass(function(result) {
+ assertEq('CONNECTED', result);
+ }));
+ } else {
+ chrome.networking.castPrivate.getWifiTDLSStatus(
+ 'aa:bb:cc:dd:ee:ff', callbackFail('Not supported'));
+ }
+ },
+ ]);
+});

Powered by Google App Engine
This is Rietveld 408576698