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

Side by Side Diff: chrome/test/data/extensions/api_test/networking_private/chromeos/test.js

Issue 2850993002: [CrOS Tether] Add the HasConnectedToHost network field to NetworkStateHandler. (Closed)
Patch Set: stevenjb@ comments. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 // The expectations in this test for the Chrome OS implementation. See 5 // The expectations in this test for the Chrome OS implementation. See
6 // networking_private_chromeos_apitest.cc for more info. 6 // networking_private_chromeos_apitest.cc for more info.
7 7
8 var callbackPass = chrome.test.callbackPass; 8 var callbackPass = chrome.test.callbackPass;
9 var callbackFail = chrome.test.callbackFail; 9 var callbackFail = chrome.test.callbackFail;
10 var assertTrue = chrome.test.assertTrue; 10 var assertTrue = chrome.test.assertTrue;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 assertEq(expectedState, state); 77 assertEq(expectedState, state);
78 chrome.networkingPrivate.onPortalDetectionCompleted.removeListener( 78 chrome.networkingPrivate.onPortalDetectionCompleted.removeListener(
79 self.onPortalDetectionCompleted); 79 self.onPortalDetectionCompleted);
80 done(); 80 done();
81 }; 81 };
82 chrome.networkingPrivate.onPortalDetectionCompleted.addListener( 82 chrome.networkingPrivate.onPortalDetectionCompleted.addListener(
83 self.onPortalDetectionCompleted); 83 self.onPortalDetectionCompleted);
84 }, 84 },
85 verifyTetherNetwork: function( 85 verifyTetherNetwork: function(
86 properties, expectedGuid, expectedName, expectedBatteryPercentage, 86 properties, expectedGuid, expectedName, expectedBatteryPercentage,
87 expectedCarrier, expectedSignalStrength) { 87 expectedCarrier, expectedSignalStrength, expectedHasConnectedToHost) {
88 //assertEq(NetworkType.Tether, properties.Type); 88 //assertEq(NetworkType.Tether, properties.Type);
89 assertEq(expectedGuid, properties.GUID); 89 assertEq(expectedGuid, properties.GUID);
90 assertEq(expectedName, 90 assertEq(expectedName,
91 properties.Name.hasOwnProperty('Active') ? properties.Name.Active 91 properties.Name.hasOwnProperty('Active') ? properties.Name.Active
92 : properties.Name); 92 : properties.Name);
93 assertEq(expectedBatteryPercentage, properties.Tether.BatteryPercentage); 93 assertEq(expectedBatteryPercentage, properties.Tether.BatteryPercentage);
94 assertEq(expectedCarrier, properties.Tether.Carrier); 94 assertEq(expectedCarrier, properties.Tether.Carrier);
95 // TODO(khorimoto): Add the expected value as a parameter once it can be set 95 assertEq(expectedHasConnectedToHost, properties.Tether.HasConnectedToHost);
96 // via the Tether component.
97 assertFalse(properties.Tether.HasConnectedToHost);
98 assertEq(expectedSignalStrength, properties.Tether.SignalStrength); 96 assertEq(expectedSignalStrength, properties.Tether.SignalStrength);
99 } 97 }
100 }; 98 };
101 99
102 var kFailure = 'Failure'; 100 var kFailure = 'Failure';
103 101
104 function networkCallbackPass() { 102 function networkCallbackPass() {
105 var callbackCompleted = chrome.test.callbackAdded(); 103 var callbackCompleted = chrome.test.callbackAdded();
106 return function(result) { 104 return function(result) {
107 chrome.test.assertNoLastError(); 105 chrome.test.assertNoLastError();
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 AllowOnlyPolicyNetworksToConnect: false, 935 AllowOnlyPolicyNetworksToConnect: false,
938 }, result); 936 }, result);
939 })); 937 }));
940 }, 938 },
941 function getTetherNetworks() { 939 function getTetherNetworks() {
942 chrome.networkingPrivate.getNetworks( 940 chrome.networkingPrivate.getNetworks(
943 {networkType: 'Tether'}, 941 {networkType: 'Tether'},
944 callbackPass(function(tetherNetworks) { 942 callbackPass(function(tetherNetworks) {
945 assertEq(2, tetherNetworks.length); 943 assertEq(2, tetherNetworks.length);
946 privateHelpers.verifyTetherNetwork(tetherNetworks[0], 'tetherGuid1', 944 privateHelpers.verifyTetherNetwork(tetherNetworks[0], 'tetherGuid1',
947 'tetherName1', 50, 'tetherCarrier1', 75); 945 'tetherName1', 50, 'tetherCarrier1', 75, true);
948 privateHelpers.verifyTetherNetwork(tetherNetworks[1], 'tetherGuid2', 946 privateHelpers.verifyTetherNetwork(tetherNetworks[1], 'tetherGuid2',
949 'tetherName2', 75, 'tetherCarrier2', 100); 947 'tetherName2', 75, 'tetherCarrier2', 100, false);
950 })); 948 }));
951 }, 949 },
952 function getTetherNetworkProperties() { 950 function getTetherNetworkProperties() {
953 chrome.networkingPrivate.getProperties( 951 chrome.networkingPrivate.getProperties(
954 'tetherGuid1', 952 'tetherGuid1',
955 callbackPass(function(tetherNetwork) { 953 callbackPass(function(tetherNetwork) {
956 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1', 954 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1',
957 'tetherName1', 50, 'tetherCarrier1', 75); 955 'tetherName1', 50, 'tetherCarrier1', 75, true);
958 })); 956 }));
959 }, 957 },
960 function getTetherNetworkManagedProperties() { 958 function getTetherNetworkManagedProperties() {
961 chrome.networkingPrivate.getManagedProperties( 959 chrome.networkingPrivate.getManagedProperties(
962 'tetherGuid1', 960 'tetherGuid1',
963 callbackPass(function(tetherNetwork) { 961 callbackPass(function(tetherNetwork) {
964 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1', 962 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1',
965 'tetherName1', 50, 'tetherCarrier1', 75); 963 'tetherName1', 50, 'tetherCarrier1', 75, true);
966 })); 964 }));
967 }, 965 },
968 function getTetherNetworkState() { 966 function getTetherNetworkState() {
969 chrome.networkingPrivate.getState( 967 chrome.networkingPrivate.getState(
970 'tetherGuid1', 968 'tetherGuid1',
971 callbackPass(function(tetherNetwork) { 969 callbackPass(function(tetherNetwork) {
972 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1', 970 privateHelpers.verifyTetherNetwork(tetherNetwork, 'tetherGuid1',
973 'tetherName1', 50, 'tetherCarrier1', 75); 971 'tetherName1', 50, 'tetherCarrier1', 75, true);
974 })); 972 }));
975 }, 973 },
976 ]; 974 ];
977 975
978 chrome.test.getConfig(function(config) { 976 chrome.test.getConfig(function(config) {
979 var args = JSON.parse(config.customArg); 977 var args = JSON.parse(config.customArg);
980 var tests = availableTests.filter(function(op) { 978 var tests = availableTests.filter(function(op) {
981 return args.test == op.name; 979 return args.test == op.name;
982 }); 980 });
983 if (tests.length !== 1) { 981 if (tests.length !== 1) {
984 chrome.test.notifyFail('Test not found ' + args.test); 982 chrome.test.notifyFail('Test not found ' + args.test);
985 return; 983 return;
986 } 984 }
987 985
988 chrome.test.runTests(tests); 986 chrome.test.runTests(tests);
989 }); 987 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698