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

Side by Side Diff: chrome/test/data/webui/settings/prefs_test_cases.js

Issue 1447103002: MD Settings: FakeSettingsPrivate for tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: proto -> interface Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @type {Array<{key: string, 6 * @type {Array<{pref: settings.FakeSettingsPrivate.Pref,
7 * type: chrome.settingsPrivate.PrefType, 7 * nextValues: Array<*>}>}
8 * values: !Array<*>}>} 8 * Test cases containing preference data. Each test case has a pref with an
9 * Test cases containing preference data. Each pref has three test values, 9 * initial value, and two "next" values used to change the pref. Intentionally,
10 * which can be used to change the pref. Intentionally, for a given pref, not 10 * for a given pref, not every "next" value is different from the previous
11 * every test value is different from the one before it; this tests what 11 * value; this tests what happens when stale changes are reported.
12 * happens when stale changes are reported.
13 */ 12 */
14 var prefsTestCases = [{ 13 var prefsTestCases = [{
15 key: 'top_level_pref', 14 pref: {
16 type: chrome.settingsPrivate.PrefType.BOOLEAN, 15 key: 'top_level_pref',
17 values: [true, false, true], 16 type: chrome.settingsPrivate.PrefType.BOOLEAN,
17 value: true,
18 },
19 nextValues: [false, true],
18 }, { 20 }, {
19 key: 'browser.enable_flash', 21 pref: {
20 type: chrome.settingsPrivate.PrefType.BOOLEAN, 22 key: 'browser.enable_flash',
21 values: [false, true, false], 23 type: chrome.settingsPrivate.PrefType.BOOLEAN,
24 value: false,
25 },
26 nextValues: [true, false],
22 }, { 27 }, {
23 key: 'browser.enable_html5', 28 pref: {
24 type: chrome.settingsPrivate.PrefType.BOOLEAN, 29 key: 'browser.enable_html5',
25 values: [true, false, false], 30 type: chrome.settingsPrivate.PrefType.BOOLEAN,
31 value: true,
32 },
33 nextValues: [false, false],
26 }, { 34 }, {
27 key: 'device.overclock', 35 pref: {
28 type: chrome.settingsPrivate.PrefType.NUMBER, 36 key: 'device.overclock',
29 values: [0, .2, .6], 37 type: chrome.settingsPrivate.PrefType.NUMBER,
38 value: 0,
39 },
40 nextValues: [.2, .6],
30 }, { 41 }, {
31 key: 'browser.on.startup.homepage', 42 pref: {
32 type: chrome.settingsPrivate.PrefType.STRING, 43 key: 'browser.on.startup.homepage',
33 values: ['example.com', 'chromium.org', 'chrome.example.com'], 44 type: chrome.settingsPrivate.PrefType.STRING,
45 value: 'example.com',
46 },
47 nextValues: ['chromium.org', 'chrome.example.com'],
34 }, { 48 }, {
35 key: 'profile.name', 49 pref: {
36 type: chrome.settingsPrivate.PrefType.STRING, 50 key: 'profile.name',
37 values: ['Puppy', 'Puppy', 'Horsey'], 51 type: chrome.settingsPrivate.PrefType.STRING,
52 value: 'Puppy',
53 },
54 nextValues: ['Puppy', 'Horsey'],
38 }, { 55 }, {
39 key: 'content.sites', 56 pref: {
40 type: chrome.settingsPrivate.PrefType.LIST, 57 key: 'content.sites',
41 // Arrays of dictionaries. 58 type: chrome.settingsPrivate.PrefType.LIST,
42 values: [ 59 // Array of dictionaries.
43 [{javascript: ['chromium.org', 'example.com'], 60 value:
44 cookies: ['example.net'], 61 [{javascript: ['chromium.org', 'example.com'],
45 mic: ['example.com'], 62 cookies: ['example.net'],
46 flash: []}, 63 mic: ['example.com'],
47 {some: 4, 64 flash: []},
48 other: 8, 65 {some: 4,
49 dictionary: 16}], 66 other: 8,
67 dictionary: 16}],
68 },
69 nextValues: [
50 [{javascript: ['example.com', 'example.net'], 70 [{javascript: ['example.com', 'example.net'],
51 cookies: ['example.net', 'example.com'], 71 cookies: ['example.net', 'example.com'],
52 mic: ['example.com']}, 72 mic: ['example.com']},
53 {some: 4, 73 {some: 4,
54 other: 8, 74 other: 8,
55 dictionary: 16}], 75 dictionary: 16}],
56 [{javascript: ['chromium.org', 'example.com'], 76 [{javascript: ['chromium.org', 'example.com'],
57 cookies: ['chromium.org', 'example.net', 'example.com'], 77 cookies: ['chromium.org', 'example.net', 'example.com'],
58 flash: ['localhost'], 78 flash: ['localhost'],
59 mic: ['example.com']}, 79 mic: ['example.com']},
60 {some: 2.2, 80 {some: 2.2,
61 dictionary: 4.4}] 81 dictionary: 4.4}],
62 ], 82 ],
63 }, { 83 }, {
64 key: 'content_settings.exceptions.notifications', 84 pref: {
65 type: chrome.settingsPrivate.PrefType.DICTIONARY, 85 key: 'content_settings.exceptions.notifications',
66 values: [{ 86 type: chrome.settingsPrivate.PrefType.DICTIONARY,
87 value: {
88 'https:\/\/foo.com,*': {
89 last_used: 1442486000.4000,
90 'setting': 0,
91 },
92 'https:\/\/bar.com,*': {
93 'last_used': 1442487000.3000,
94 'setting': 1,
95 },
96 'https:\/\/baz.com,*': {
97 'last_used': 1442482000.8000,
98 'setting': 2,
99 },
100 },
101 },
102 nextValues: [{
67 'https:\/\/foo.com,*': { 103 'https:\/\/foo.com,*': {
68 last_used: 1442486000.4000, 104 last_used: 1442486000.4000,
69 'setting': 0, 105 'setting': 0,
70 },
71 'https:\/\/bar.com,*': {
72 'last_used': 1442487000.3000,
73 'setting': 1,
74 },
75 'https:\/\/baz.com,*': {
76 'last_used': 1442482000.8000,
77 'setting': 2,
78 },
79 }, {
80 'https:\/\/foo.com,*': {
81 last_used: 1442486000.4000,
82 'setting': 0,
83 }, 106 },
84 'https:\/\/example.com,*': { 107 'https:\/\/example.com,*': {
85 'last_used': 1442489000.1000, 108 'last_used': 1442489000.1000,
86 'setting': 2, 109 'setting': 2,
87 }, 110 },
88 'https:\/\/baz.com,*': { 111 'https:\/\/baz.com,*': {
89 'last_used': 1442484000.9000, 112 'last_used': 1442484000.9000,
90 'setting': 1, 113 'setting': 1,
91 }, 114 },
92 }, { 115 }, {
93 'https:\/\/foo.com,*': { 116 'https:\/\/foo.com,*': {
94 last_used: 1442488000.8000, 117 last_used: 1442488000.8000,
95 'setting': 1, 118 'setting': 1,
96 }, 119 },
97 'https:\/\/example.com,*': { 120 'https:\/\/example.com,*': {
98 'last_used': 1442489000.1000, 121 'last_used': 1442489000.1000,
99 'setting': 2, 122 'setting': 2,
100 }, 123 },
101 }], 124 }],
102 }]; 125 }];
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/fake_settings_private.js ('k') | chrome/test/data/webui/settings/prefs_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698