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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/preference/standard/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/preference/standard/test.html
diff --git a/chrome/test/data/extensions/api_test/preference/standard/test.html b/chrome/test/data/extensions/api_test/preference/standard/test.html
new file mode 100644
index 0000000000000000000000000000000000000000..95864413066dde37f32b04cda9e596e4231bed93
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/preference/standard/test.html
@@ -0,0 +1,69 @@
+<script>
+// Preferences API test
+// Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceApi
+
+var preferences_to_test = [
+ {
+ root: chrome.experimental.privacy.network,
+ preferences: [
+ 'networkPredictionEnabled'
+ ]
+ },
+ {
+ root: chrome.experimental.privacy.websites,
+ preferences: [
+ 'thirdPartyCookiesAllowed',
+ 'hyperlinkAuditingEnabled',
+ 'referrersEnabled'
+ ]
+ },
+ {
+ root: chrome.experimental.privacy.services,
+ preferences: [
+ 'alternateErrorPagesEnabled',
+ 'autofillEnabled',
+ 'instantEnabled',
+ // TODO(mkwst): 'metricsReportingEnabled',
+ 'safeBrowsingEnabled',
+ 'searchSuggestEnabled',
+ 'translationServiceEnabled'
+ ]
+ },
+];
+
+function expect(expected, message) {
+ return chrome.test.callbackPass(function(value) {
+ chrome.test.assertEq(expected, value, message);
+ });
+}
+
+function expectFalse(pref) {
+ return expect({
+ value: false,
+ levelOfControl: 'controllable_by_this_extension'
+ }, '`' + pref + '` is expected to be false.');
+}
+
+function prefGetter(pref) {
+ this[pref].get({}, expectFalse(pref));
+}
+
+function prefSetter(pref) {
+ this[pref].set({value: true}, chrome.test.callbackPass());
+}
+
+chrome.test.runTests([
+ function getPreferences() {
+ for (var i = 0; i < preferences_to_test.length; i++) {
+ preferences_to_test[i].preferences.forEach(
+ prefGetter.bind(preferences_to_test[i].root));
+ }
+ },
+ function setGlobals() {
+ for (var i = 0; i < preferences_to_test.length; i++) {
+ preferences_to_test[i].preferences.forEach(
+ prefSetter.bind(preferences_to_test[i].root));
+ }
+ }
+]);
+</script>
« 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