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

Side by Side Diff: chrome/test/data/extensions/api_test/management/test/uninstall.js

Issue 137793011: Require user confirmation for chrome.management.uninstall except when uninstalling self. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 function uninstall(name) { 4 function uninstall(name) {
5 var expected_id; 5 var expected_id;
6 listenOnce(chrome.management.onUninstalled, function(id) { 6 listenOnce(chrome.management.onUninstalled, function(id) {
7 assertEq(expected_id, id); 7 assertEq(expected_id, id);
8 }); 8 });
9 9
10 chrome.management.getAll(callback(function(items) { 10 chrome.management.getAll(callback(function(items) {
11 var old_count = items.length; 11 var old_count = items.length;
12 var item = getItemNamed(items, name); 12 var item = getItemNamed(items, name);
13 expected_id = item.id; 13 expected_id = item.id;
14 chrome.management.uninstall(item.id, callback(function() { 14 chrome.test.runWithUserGesture(function() {
15 chrome.management.getAll(callback(function(items2) { 15 chrome.management.uninstall(item.id, callback(function() {
16 assertEq(old_count - 1, items2.length); 16 chrome.management.getAll(callback(function(items2) {
17 for (var i = 0; i < items2.length; i++) { 17 assertEq(old_count - 1, items2.length);
18 assertFalse(items2[i].name == name); 18 for (var i = 0; i < items2.length; i++) {
19 } 19 assertFalse(items2[i].name == name);
20 }
21 }));
20 })); 22 }));
21 })); 23 });
22 })); 24 }));
23 } 25 }
24 26
25 var tests = [ 27 var tests = [
26 function uninstallEnabledApp() { 28 function uninstallEnabledApp() {
27 uninstall("enabled_app"); 29 uninstall("enabled_app");
28 }, 30 },
29 31
30 function uninstallDisabledApp() { 32 function uninstallDisabledApp() {
31 uninstall("disabled_app"); 33 uninstall("disabled_app");
32 }, 34 },
33 35
34 function uninstallEnabledExtension() { 36 function uninstallEnabledExtension() {
35 uninstall("enabled_extension"); 37 uninstall("enabled_extension");
36 }, 38 },
37 39
38 function uninstallDisabledExtension() { 40 function uninstallDisabledExtension() {
39 uninstall("disabled_extension"); 41 uninstall("disabled_extension");
40 } 42 }
41 ]; 43 ];
42 44
43 chrome.test.runTests(tests); 45 chrome.test.runTests(tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698