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

Side by Side Diff: chrome/test/data/extensions/api_test/settings/managed_storage/background.js

Issue 10807086: Trigger chrome.storage.onChanged events for policy updates on the 'managed' namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, addressed comments, fixed ManagedStorageDisabled test Created 8 years, 5 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
OLDNEW
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 chrome.test.runTests([ 5 chrome.test.runTests([
6 function getPolicy() { 6 function getPolicy() {
7 chrome.storage.managed.get( 7 chrome.storage.managed.get(
8 'string-policy', 8 'string-policy',
9 chrome.test.callbackPass(function(results) { 9 chrome.test.callbackPass(function(results) {
10 chrome.test.assertEq({ 10 chrome.test.assertEq({
11 'string-policy': 'value' 11 'string-policy': 'value'
12 }, results); 12 }, results);
13 })); 13 }));
14 }, 14 },
15 15
16 function getListOfPolicies() { 16 function getListOfPolicies() {
17 chrome.storage.managed.get( 17 chrome.storage.managed.get(
18 ['string-policy', 'int-policy', 'no-such-thing'], 18 ['string-policy', 'int-policy', 'no-such-thing'],
19 chrome.test.callbackPass(function(results) { 19 chrome.test.callbackPass(function(results) {
20 chrome.test.assertEq({ 20 chrome.test.assertEq({
21 'string-policy': 'value', 21 'string-policy': 'value',
22 'int-policy': -123, 22 'int-policy': -123,
23 }, results); 23 }, results);
24 })); 24 }));
25 }, 25 },
26 26
27 function getAllPolicies() { 27 function getAllPolicies() {
28 chrome.storage.managed.get( 28 chrome.storage.managed.get(
29 null,
30 chrome.test.callbackPass(function(results) { 29 chrome.test.callbackPass(function(results) {
31 chrome.test.assertEq({ 30 chrome.test.assertEq({
32 'string-policy': 'value', 31 'string-policy': 'value',
33 'int-policy': -123, 32 'int-policy': -123,
34 'double-policy': 456e7, 33 'double-policy': 456e7,
35 'boolean-policy': true, 34 'boolean-policy': true,
36 'list-policy': [ 'one', 'two', 'three' ], 35 'list-policy': [ 'one', 'two', 'three' ],
37 'dict-policy': { 36 'dict-policy': {
38 'list': [ { 'one': 1, 'two': 2 }, { 'three': 3} ] 37 'list': [ { 'one': 1, 'two': 2 }, { 'three': 3} ]
39 } 38 }
40 }, results); 39 }, results);
41 })); 40 }));
42 }, 41 },
43 42
44 function getBytesInUse() { 43 function getBytesInUse() {
45 chrome.storage.managed.getBytesInUse( 44 chrome.storage.managed.getBytesInUse(
46 null,
47 chrome.test.callbackPass(function(bytes) { 45 chrome.test.callbackPass(function(bytes) {
48 chrome.test.assertEq(0, bytes); 46 chrome.test.assertEq(0, bytes);
49 })); 47 }));
50 }, 48 },
51 49
52 function writingFails() { 50 function writingFails() {
53 var kReadOnlyError = 'This is a read-only store.'; 51 var kReadOnlyError = 'This is a read-only store.';
54 chrome.storage.managed.clear(chrome.test.callbackFail(kReadOnlyError)); 52 chrome.storage.managed.clear(chrome.test.callbackFail(kReadOnlyError));
55 chrome.storage.managed.remove( 53 chrome.storage.managed.remove(
56 'string-policy', 54 'string-policy',
57 chrome.test.callbackFail(kReadOnlyError)); 55 chrome.test.callbackFail(kReadOnlyError));
58 chrome.storage.managed.set({ 56 chrome.storage.managed.set({
59 'key': 'value' 57 'key': 'value'
60 }, chrome.test.callbackFail(kReadOnlyError)); 58 }, chrome.test.callbackFail(kReadOnlyError));
61 } 59 }
62 ]); 60 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698