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

Side by Side Diff: chrome/test/data/extensions/api_test/preference/standard/test.html

Issue 7298005: Expose privacy-relevant preferences via Chrome's extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing. Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/preference/standard/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <script>
2 // Preferences API test
3 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceApi
4
5 var preferences_to_test = [
6 {
7 root: chrome.experimental.privacy.network,
8 preferences: [
9 'networkPredictionEnabled'
10 ]
11 },
12 {
13 root: chrome.experimental.privacy.websites,
14 preferences: [
15 'thirdPartyCookiesAllowed',
16 'hyperlinkAuditingEnabled',
17 'referrersEnabled'
18 ]
19 },
20 {
21 root: chrome.experimental.privacy.services,
22 preferences: [
23 'alternateErrorPagesEnabled',
24 'autofillEnabled',
25 'instantEnabled',
26 // TODO(mkwst): 'metricsReportingEnabled',
27 'safeBrowsingEnabled',
28 'searchSuggestEnabled',
29 'translationServiceEnabled'
30 ]
31 },
32 ];
33
34 function expect(expected, message) {
35 return chrome.test.callbackPass(function(value) {
36 chrome.test.assertEq(expected, value, message);
37 });
38 }
39
40 function expectFalse(pref) {
41 return expect({
42 value: false,
43 levelOfControl: 'controllable_by_this_extension'
44 }, '`' + pref + '` is expected to be false.');
45 }
46
47 function prefGetter(pref) {
48 this[pref].get({}, expectFalse(pref));
49 }
50
51 function prefSetter(pref) {
52 this[pref].set({value: true}, chrome.test.callbackPass());
53 }
54
55 chrome.test.runTests([
56 function getPreferences() {
57 for (var i = 0; i < preferences_to_test.length; i++) {
58 preferences_to_test[i].preferences.forEach(
59 prefGetter.bind(preferences_to_test[i].root));
60 }
61 },
62 function setGlobals() {
63 for (var i = 0; i < preferences_to_test.length; i++) {
64 preferences_to_test[i].preferences.forEach(
65 prefSetter.bind(preferences_to_test[i].root));
66 }
67 }
68 ]);
69 </script>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/preference/standard/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698