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. |
| 19 if (keys[i] == 'sessionType') { |
| 20 chrome.test.assertEq('normal', values[keys[i]]); |
| 21 } |
| 22 // PlayStoreStatus by default should be not available. |
| 23 if (keys[i] == 'playStoreStatus') { |
| 24 chrome.test.assertEq('not available', values[keys[i]]); |
| 25 } |
18 // Debug | 26 // Debug |
19 if (keys[i] in values) { | 27 if (keys[i] in values) { |
20 console.log(' values["' + keys[i] + '"] = ' + | 28 console.log(' values["' + keys[i] + '"] = ' + |
21 values[keys[i]]); | 29 values[keys[i]]); |
22 } else { | 30 } else { |
23 console.log(' ' + keys[i] + ' is missing in values'); | 31 console.log(' ' + keys[i] + ' is missing in values'); |
24 } | 32 } |
25 | 33 |
26 chrome.test.assertEq(fails.indexOf(keys[i]) == -1, | 34 chrome.test.assertEq(fails.indexOf(keys[i]) == -1, |
27 keys[i] in values); | 35 keys[i] in values); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 )); | 108 )); |
101 } | 109 } |
102 | 110 |
103 // Run generated chrome.chromeosInfoPrivate.get() tests. | 111 // Run generated chrome.chromeosInfoPrivate.get() tests. |
104 var tests = generateTestsForKeys(['hwid', | 112 var tests = generateTestsForKeys(['hwid', |
105 'customizationId', | 113 'customizationId', |
106 'homeProvider', | 114 'homeProvider', |
107 'initialLocale', | 115 'initialLocale', |
108 'board', | 116 'board', |
109 'isOwner', | 117 'isOwner', |
| 118 'sessionType', |
| 119 'playStoreStatus', |
110 'clientId', | 120 'clientId', |
111 'a11yLargeCursorEnabled', | 121 'a11yLargeCursorEnabled', |
112 'a11yStickyKeysEnabled', | 122 'a11yStickyKeysEnabled', |
113 'a11ySpokenFeedbackEnabled', | 123 'a11ySpokenFeedbackEnabled', |
114 'a11yHighContrastEnabled', | 124 'a11yHighContrastEnabled', |
115 'a11yScreenMagnifierEnabled', | 125 'a11yScreenMagnifierEnabled', |
116 'a11yAutoClickEnabled', | 126 'a11yAutoClickEnabled', |
117 'a11yVirtualKeyboardEnabled', | 127 'a11yVirtualKeyboardEnabled', |
118 'sendFunctionKeys', | 128 'sendFunctionKeys', |
119 'timezone', | 129 'timezone', |
120 'supportedTimezones']) | 130 'supportedTimezones']) |
121 | 131 |
122 // Add chrome.chromeosInfoPrivate.set() test. | 132 // Add chrome.chromeosInfoPrivate.set() test. |
123 tests.push(timezoneSetTest); | 133 tests.push(timezoneSetTest); |
124 tests.push(prefsTest); | 134 tests.push(prefsTest); |
125 | 135 |
126 chrome.test.runTests(tests); | 136 chrome.test.runTests(tests); |
OLD | NEW |