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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js
diff --git a/chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js b/chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..e4bda52367049eb3a34654f4f2a75afbfcf1a793
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js
@@ -0,0 +1,42 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function testChromeStorage(backend, callback) {
+ 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
+ if (result.foo) {
+ chrome.test.notifyFail('got data before setting!');
+ return;
+ }
+
+ // We set the value but also want to make sure it is correctly saved.
+ backend.set({ 'foo': 'bar' }, function() {
+ 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
+ if (result.foo != 'bar')
+ 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
+ else
+ callback();
+ });
+ });
+ });
+}
+
+function testChromeStorageLocal(callback) {
+ 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
+}
+
+function testChromeStorageSync(callback) {
+ testChromeStorage(chrome.storage.sync, callback);
+}
+
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched', function() {
+ // Test functions will call a callback if succeeded, notifyFail() otherwise.
+ // The last test function will call notifyPass().
+ testChromeStorageLocal(function() {
+ testChromeStorageSync(function() {
+ chrome.test.notifyPass();
+ });
+ });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698