| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Preferences API test | 5 // Preferences API test |
| 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceApi | 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceApi |
| 7 | 7 |
| 8 var preferences_to_test = [ | 8 var preferences_to_test = [ |
| 9 { | 9 { |
| 10 root: chrome.privacy.network, | 10 root: chrome.privacy.network, |
| 11 preferences: [ | 11 preferences: [ |
| 12 'networkPredictionEnabled', | 12 'networkPredictionEnabled', |
| 13 'webRTCMultipleRoutesEnabled' | 13 'webRTCMultipleRoutesEnabled', |
| 14 'webRTCNonProxiedUdpTransportEnabled' |
| 14 ] | 15 ] |
| 15 }, | 16 }, |
| 16 { | 17 { |
| 17 root: chrome.privacy.websites, | 18 root: chrome.privacy.websites, |
| 18 preferences: [ | 19 preferences: [ |
| 19 'thirdPartyCookiesAllowed', | 20 'thirdPartyCookiesAllowed', |
| 20 'hyperlinkAuditingEnabled', | 21 'hyperlinkAuditingEnabled', |
| 21 'referrersEnabled', | 22 'referrersEnabled', |
| 22 'protectedContentEnabled' | 23 'protectedContentEnabled' |
| 23 ] | 24 ] |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 'searchSuggestEnabled', | 35 'searchSuggestEnabled', |
| 35 'spellingServiceEnabled', | 36 'spellingServiceEnabled', |
| 36 'translationServiceEnabled' | 37 'translationServiceEnabled' |
| 37 ] | 38 ] |
| 38 }, | 39 }, |
| 39 ]; | 40 ]; |
| 40 | 41 |
| 41 // Some preferences are only present on certain platforms or are hidden | 42 // Some preferences are only present on certain platforms or are hidden |
| 42 // behind flags and might not be present when this test runs. | 43 // behind flags and might not be present when this test runs. |
| 43 var possibly_missing_preferences = new Set([ | 44 var possibly_missing_preferences = new Set([ |
| 44 'protectedContentEnabled', // Windows/ChromeOS only | 45 'protectedContentEnabled', // Windows/ChromeOS only |
| 45 'webRTCMultipleRoutesEnabled' // requires ENABLE_WEBRTC=1 | 46 'webRTCMultipleRoutesEnabled', // requires ENABLE_WEBRTC=1 |
| 47 'webRTCNonProxiedUdpTransportEnabled' // requires ENABLE_WEBRTC=1 |
| 46 ]); | 48 ]); |
| 47 | 49 |
| 48 function expect(expected, message) { | 50 function expect(expected, message) { |
| 49 return chrome.test.callbackPass(function(value) { | 51 return chrome.test.callbackPass(function(value) { |
| 50 chrome.test.assertEq(expected, value, message); | 52 chrome.test.assertEq(expected, value, message); |
| 51 }); | 53 }); |
| 52 } | 54 } |
| 53 | 55 |
| 54 function expectFalse(pref) { | 56 function expectFalse(pref) { |
| 55 return expect({ | 57 return expect({ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 79 prefGetter.bind(preferences_to_test[i].root)); | 81 prefGetter.bind(preferences_to_test[i].root)); |
| 80 } | 82 } |
| 81 }, | 83 }, |
| 82 function setGlobals() { | 84 function setGlobals() { |
| 83 for (var i = 0; i < preferences_to_test.length; i++) { | 85 for (var i = 0; i < preferences_to_test.length; i++) { |
| 84 preferences_to_test[i].preferences.forEach( | 86 preferences_to_test[i].preferences.forEach( |
| 85 prefSetter.bind(preferences_to_test[i].root)); | 87 prefSetter.bind(preferences_to_test[i].root)); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 ]); | 90 ]); |
| OLD | NEW |