1 // Copyright 2014 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 function testChromeStorage(backend
, callback
) {
6 backend
.get('foo', chrome
.test
.callbackPass(function(result
) {
7 chrome
.test
.assertEq(undefined, result
.foo
,
8 'no value should have been found');
9 chrome
.test
.assertEq(undefined, chrome
.runtime
.lastError
);
11 // We set the value but also want to make sure it is correctly saved.
12 backend
.set({ 'foo': 'bar' }, chrome
.test
.callbackPass(function() {
13 backend
.get('foo', chrome
.test
.callbackPass(function(result
) {
14 chrome
.test
.assertEq('bar', result
.foo
, 'value should be written');
20 chrome
.app
.runtime
.onLaunched
.addListener(function() {
21 chrome
.test
.sendMessage('Launched', function() {
22 chrome
.test
.runTests([
23 function testChromeStorageLocal() {
24 testChromeStorage(chrome
.storage
.local
);
26 function testChromeStorageSync() {
27 testChromeStorage(chrome
.storage
.sync
);