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

Side by Side Diff: chrome/test/data/extensions/api_test/management/management_policy/prohibited.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: Fix ExtensionManagementApiBrowserTest.LaunchApp 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 4
5 var callback = chrome.test.callback; 5 var callback = chrome.test.callback;
6 6
7 // The names of the extensions to operate on, from their manifest.json files. 7 // The names of the extensions to operate on, from their manifest.json files.
8 var ENABLED_NAME = 'enabled_extension'; 8 var ENABLED_NAME = 'enabled_extension';
9 var DISABLED_NAME = 'disabled_extension'; 9 var DISABLED_NAME = 'disabled_extension';
10 var UNINSTALL_NAME = 'enabled_extension'; 10 var UNINSTALL_NAME = 'enabled_extension';
11 11
12 var EXPECTED_ERROR = 'Extension * cannot be modified by user'; 12 var EXPECTED_ERROR = 'Extension * cannot be modified by user.';
13 13
14 // Given a list of extension items, finds the one with the given name. 14 // Given a list of extension items, finds the one with the given name.
15 function findByName(items, name) { 15 function findByName(items, name) {
16 var item; 16 var item;
17 for (var i = 0; i < items.length; i++) { 17 for (var i = 0; i < items.length; i++) {
18 item = items[i]; 18 item = items[i];
19 if (item.name == name) 19 if (item.name == name)
20 break; 20 break;
21 } 21 }
22 if (name != item.name) 22 if (name != item.name)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }, 62 },
63 63
64 // Tests uninstalling an extension, expecting it to fail. 64 // Tests uninstalling an extension, expecting it to fail.
65 function prohibitedUninstall() { 65 function prohibitedUninstall() {
66 chrome.management.getAll(callback(function(items) { 66 chrome.management.getAll(callback(function(items) {
67 var item = findByName(items, UNINSTALL_NAME); 67 var item = findByName(items, UNINSTALL_NAME);
68 chrome.test.assertEq(false, item.mayDisable); 68 chrome.test.assertEq(false, item.mayDisable);
69 69
70 var id = item.id; 70 var id = item.id;
71 var expectedError = EXPECTED_ERROR.replace('*', id); 71 var expectedError = EXPECTED_ERROR.replace('*', id);
72 chrome.management.uninstall(id, 72 chrome.test.runWithUserGesture(function() {
73 callback(function() { checkEnabled(id, true); }, expectedError)); 73 chrome.management.uninstall(id,
74 callback(function() { checkEnabled(id, true); }, expectedError));
75 });
74 })); 76 }));
75 } 77 }
76 ]; 78 ];
77 79
78 chrome.test.runTests(tests); 80 chrome.test.runTests(tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698