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
3 // found in the LICENSE file.
7 chrome
.storage
.managed
.get(
9 chrome
.test
.callbackPass(function(results
) {
10 chrome
.test
.assertEq({
11 'string-policy': 'value'
16 function getListOfPolicies() {
17 chrome
.storage
.managed
.get(
18 ['string-policy', 'int-policy', 'no-such-thing'],
19 chrome
.test
.callbackPass(function(results
) {
20 chrome
.test
.assertEq({
21 'string-policy': 'value',
27 function getAllPolicies() {
28 chrome
.storage
.managed
.get(
29 chrome
.test
.callbackPass(function(results
) {
30 chrome
.test
.assertEq({
31 'string-policy': 'value',
33 'double-policy': 456e7
,
34 'boolean-policy': true,
35 'list-policy': [ 'one', 'two', 'three' ],
37 'list': [ { 'one': 1, 'two': 2 }, { 'three': 3} ]
43 function getBytesInUse() {
44 chrome
.storage
.managed
.getBytesInUse(
45 chrome
.test
.callbackPass(function(bytes
) {
46 chrome
.test
.assertEq(0, bytes
);
50 function writingFails() {
51 var kReadOnlyError
= 'This is a read-only store.';
52 chrome
.storage
.managed
.clear(chrome
.test
.callbackFail(kReadOnlyError
));
53 chrome
.storage
.managed
.remove(
55 chrome
.test
.callbackFail(kReadOnlyError
));
56 chrome
.storage
.managed
.set({
58 }, chrome
.test
.callbackFail(kReadOnlyError
));