Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / management / uninstall_extension / background.js
blobf105df0913eb20f2c0199743fdc30a3f50a9432b
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
3 // found in the LICENSE file.
5 // The name of the extension to uninstall, from manifest.json.
6 var EXPECTED_NAME = 'Auto-Update Test';
8 chrome.management.getAll(function(items) {
9 for (var i = 0; i < items.length; i++) {
10 var item = items[i];
11 if (item.name != EXPECTED_NAME) continue;
12 var id = item.id;
13 chrome.test.assertEq(false, item.mayDisable);
14 chrome.test.runWithUserGesture(function() {
15 chrome.management.uninstall(id, function() {
16 // Check that the right error occured.
17 var expectedError = 'Extension ' + id + ' cannot be modified by user.';
18 chrome.test.assertEq(expectedError, chrome.runtime.lastError.message);
19 chrome.test.sendMessage('ready');
20 });
21 });
23 });