Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 pass = chrome.test.callbackPass; | 5 var pass = chrome.test.callbackPass; |
| 6 var fail = chrome.test.callbackFail; | 6 var fail = chrome.test.callbackFail; |
| 7 | 7 |
| 8 function getTestFunctionFor(keys, fails) { | 8 function getTestFunctionFor(keys, fails) { |
| 9 return function generatedTest () { | 9 return function generatedTest () { |
| 10 // Debug. | 10 // Debug. |
| 11 console.warn('keys: ' + keys + '; fails: ' + fails); | 11 console.warn('keys: ' + keys + '; fails: ' + fails); |
| 12 | 12 |
| 13 chrome.chromeosInfoPrivate.get( | 13 chrome.chromeosInfoPrivate.get( |
| 14 keys, | 14 keys, |
| 15 pass( | 15 pass( |
| 16 function(values) { | 16 function(values) { |
| 17 for (var i = 0; i < keys.length; ++i) { | 17 for (var i = 0; i < keys.length; ++i) { |
| 18 // Default session type should be normal. | 18 // Default session type should be normal. |
| 19 if (keys[i] == 'sessionType') { | 19 if (keys[i] == 'sessionType') { |
| 20 chrome.test.assertEq('normal', values[keys[i]]); | 20 chrome.test.assertEq('normal', values[keys[i]]); |
| 21 } | 21 } |
| 22 // PlayStoreStatus by default should be not available. | 22 // PlayStoreStatus by default should be not available. |
| 23 if (keys[i] == 'playStoreStatus') { | 23 if (keys[i] == 'playStoreStatus') { |
| 24 chrome.test.assertEq('not available', values[keys[i]]); | 24 chrome.test.assertEq('not available', values[keys[i]]); |
| 25 } | 25 } |
| 26 // ManagedDeviceStatus by default should be not managed. | |
|
tbarzic
2017/02/22 02:18:35
nit: I'd remove this comment - it doesn't add too
Wenzhao (Colin) Zang
2017/02/22 03:11:07
Done.
| |
| 27 if (keys[i] == 'managedDeviceStatus') { | |
| 28 chrome.test.assertEq('not managed', values[keys[i]]); | |
| 29 } | |
| 26 // Debug | 30 // Debug |
| 27 if (keys[i] in values) { | 31 if (keys[i] in values) { |
| 28 console.log(' values["' + keys[i] + '"] = ' + | 32 console.log(' values["' + keys[i] + '"] = ' + |
| 29 values[keys[i]]); | 33 values[keys[i]]); |
| 30 } else { | 34 } else { |
| 31 console.log(' ' + keys[i] + ' is missing in values'); | 35 console.log(' ' + keys[i] + ' is missing in values'); |
| 32 } | 36 } |
| 33 | 37 |
| 34 chrome.test.assertEq(fails.indexOf(keys[i]) == -1, | 38 chrome.test.assertEq(fails.indexOf(keys[i]) == -1, |
| 35 keys[i] in values); | 39 keys[i] in values); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 114 |
| 111 // Run generated chrome.chromeosInfoPrivate.get() tests. | 115 // Run generated chrome.chromeosInfoPrivate.get() tests. |
| 112 var tests = generateTestsForKeys(['hwid', | 116 var tests = generateTestsForKeys(['hwid', |
| 113 'customizationId', | 117 'customizationId', |
| 114 'homeProvider', | 118 'homeProvider', |
| 115 'initialLocale', | 119 'initialLocale', |
| 116 'board', | 120 'board', |
| 117 'isOwner', | 121 'isOwner', |
| 118 'sessionType', | 122 'sessionType', |
| 119 'playStoreStatus', | 123 'playStoreStatus', |
| 124 'managedDeviceStatus', | |
| 120 'clientId', | 125 'clientId', |
| 121 'a11yLargeCursorEnabled', | 126 'a11yLargeCursorEnabled', |
| 122 'a11yStickyKeysEnabled', | 127 'a11yStickyKeysEnabled', |
| 123 'a11ySpokenFeedbackEnabled', | 128 'a11ySpokenFeedbackEnabled', |
| 124 'a11yHighContrastEnabled', | 129 'a11yHighContrastEnabled', |
| 125 'a11yScreenMagnifierEnabled', | 130 'a11yScreenMagnifierEnabled', |
| 126 'a11yAutoClickEnabled', | 131 'a11yAutoClickEnabled', |
| 127 'a11yVirtualKeyboardEnabled', | 132 'a11yVirtualKeyboardEnabled', |
| 128 'sendFunctionKeys', | 133 'sendFunctionKeys', |
| 129 'timezone', | 134 'timezone', |
| 130 'supportedTimezones']) | 135 'supportedTimezones']) |
| 131 | 136 |
| 132 // Add chrome.chromeosInfoPrivate.set() test. | 137 // Add chrome.chromeosInfoPrivate.set() test. |
| 133 tests.push(timezoneSetTest); | 138 tests.push(timezoneSetTest); |
| 134 tests.push(prefsTest); | 139 tests.push(prefsTest); |
| 135 | 140 |
| 136 chrome.test.runTests(tests); | 141 chrome.test.runTests(tests); |
| OLD | NEW |