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

Side by Side Diff: chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js

Issue 123733003: Get ride of chrome.storage.* data when removing an application. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 function testChromeStorage(backend, callback) {
6 backend.get('foo', function(result) {
not at google - send to devlin 2014/01/08 18:01:36 wrap this function(result) in a chrome.test.callba
7 if (result.foo) {
8 chrome.test.notifyFail('got data before setting!');
9 return;
10 }
11
12 // We set the value but also want to make sure it is correctly saved.
13 backend.set({ 'foo': 'bar' }, function() {
14 backend.get('foo', function(result) {
not at google - send to devlin 2014/01/08 18:01:36 likewise here and the line above. often people ali
15 if (result.foo != 'bar')
16 chrome.test.notifyFail('chrome storage unexpected failure');
not at google - send to devlin 2014/01/08 18:01:36 use chrome.test.assertEq('bar', result.foo) for a
17 else
18 callback();
19 });
20 });
21 });
22 }
23
24 function testChromeStorageLocal(callback) {
25 testChromeStorage(chrome.storage.local, callback);
not at google - send to devlin 2014/01/08 18:01:36 callback flow much nicer, and TBH not even sure if
26 }
27
28 function testChromeStorageSync(callback) {
29 testChromeStorage(chrome.storage.sync, callback);
30 }
31
32 chrome.app.runtime.onLaunched.addListener(function() {
33 chrome.test.sendMessage('Launched', function() {
34 // Test functions will call a callback if succeeded, notifyFail() otherwise.
35 // The last test function will call notifyPass().
36 testChromeStorageLocal(function() {
37 testChromeStorageSync(function() {
38 chrome.test.notifyPass();
39 });
40 });
41 });
42 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698