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

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..9ad46372f3f0e174a6eff416be0663a33e06156f
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/reinstall_data_cleanup/test.js
@@ -0,0 +1,48 @@
+// 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.
+
+var gNbTests = 0;
+var gFailed = false;
not at google - send to devlin 2014/01/08 02:49:17 instead of all this global state can testChromeSto
mlamouri (slow - plz ping) 2014/01/08 17:42:31 Sure. I did the change, it is quite better.
+
+function done(success) {
+ gFailed |= !success;
+ gNbTests--;
+
+ if (!gNbTests)
+ gFailed ? chrome.test.notifyFail('test failed') : chrome.test.notifyPass();
+}
+
+function testChromeStorage(backend) {
+ backend.get('foo', function(result) {
+ if (result.foo) {
+ done(false);
+ return;
+ }
+
+ // We set the value but also want to make sure it is correctly saved.
+ backend.set( { 'foo': 'bar'}, function() {
not at google - send to devlin 2014/01/08 02:49:17 nit: whitespace
mlamouri (slow - plz ping) 2014/01/08 17:42:31 Done.
+ backend.get('foo', function(result) {
+ done(result.foo == 'bar');
+ });
+ });
+ });
+}
+
+function testChromeStorageLocal() {
+ testChromeStorage(chrome.storage.local);
+}
+
+function testChromeStorageSync() {
+ testChromeStorage(chrome.storage.sync);
+}
+
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.test.sendMessage('Launched', function() {
+ gNbTests = 2;
+ // done() will have to be called <gNbTests> times to finish this test.
+
+ testChromeStorageLocal();
+ testChromeStorageSync();
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698