Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / settings / managed_storage / background.js
blob8687b0faf20b3463f6a4d0ba6fa89f4ae65b6ac8
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.
5 chrome.test.runTests([
6 function getPolicy() {
7 chrome.storage.managed.get(
8 'string-policy',
9 chrome.test.callbackPass(function(results) {
10 chrome.test.assertEq({
11 'string-policy': 'value'
12 }, results);
13 }));
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',
22 'int-policy': -123,
23 }, results);
24 }));
27 function getAllPolicies() {
28 chrome.storage.managed.get(
29 chrome.test.callbackPass(function(results) {
30 chrome.test.assertEq({
31 'string-policy': 'value',
32 'int-policy': -123,
33 'double-policy': 456e7,
34 'boolean-policy': true,
35 'list-policy': [ 'one', 'two', 'three' ],
36 'dict-policy': {
37 'list': [ { 'one': 1, 'two': 2 }, { 'three': 3} ]
39 }, results);
40 }));
43 function getBytesInUse() {
44 chrome.storage.managed.getBytesInUse(
45 chrome.test.callbackPass(function(bytes) {
46 chrome.test.assertEq(0, bytes);
47 }));
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(
54 'string-policy',
55 chrome.test.callbackFail(kReadOnlyError));
56 chrome.storage.managed.set({
57 'key': 'value'
58 }, chrome.test.callbackFail(kReadOnlyError));
60 ]);