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

Side by Side Diff: chrome/test/data/extensions/api_test/webstore_private/accepted.js

Issue 15292011: Prevent duplicate webstore install requests being serviced. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Tests where the beginInstallWithManifest3 dialog would be auto-accepted 5 // Tests where the beginInstallWithManifest3 dialog would be auto-accepted
6 // (including a few cases where this does not matter). 6 // (including a few cases where this does not matter).
7 7
8 var tests = [ 8 var tests = [
9 9
10 function completeBeforeBegin() { 10 function completeBeforeBegin() {
(...skipping 22 matching lines...) Expand all
33 }, 33 },
34 34
35 function successfulInstall() { 35 function successfulInstall() {
36 // See things through all the way to a successful install. 36 // See things through all the way to a successful install.
37 listenOnce(chrome.management.onInstalled, function(info) { 37 listenOnce(chrome.management.onInstalled, function(info) {
38 assertEq(info.id, extensionId); 38 assertEq(info.id, extensionId);
39 }); 39 });
40 40
41 var manifest = getManifest(); 41 var manifest = getManifest();
42 getIconData(function(icon) { 42 getIconData(function(icon) {
43 installAndCleanUp(
44 {'id': extensionId, 'iconData': icon, 'manifest': manifest},
45 function() {});
46 });
47 },
43 48
44 // Begin installing. 49 function duplicateInstall() {
45 chrome.webstorePrivate.beginInstallWithManifest3( 50 // See things through all the way to a successful install.
46 {'id': extensionId,'iconData': icon, 'manifest': manifest }, 51 listenOnce(chrome.management.onInstalled, function(info) {
47 function(result) { 52 assertEq(info.id, extensionId);
48 assertNoLastError(); 53 });
49 assertEq(result, "");
50 54
51 // Now complete the installation. 55 var manifest = getManifest();
52 chrome.webstorePrivate.completeInstall(extensionId, callbackPass()); 56 getIconData(function(icon) {
53 }); 57 installAndCleanUp(
58 {'id': extensionId, 'iconData': icon, 'manifest': manifest},
59 function() {
60 // Kick off a serial second install. This should fail.
61 var expectedError = "This item is already installed";
62 chrome.webstorePrivate.beginInstallWithManifest3(
63 {'id': extensionId, 'iconData': icon, 'manifest': manifest},
64 callbackFail(expectedError));
65 });
66
67 // Kick off a simultaneous second install. This should fail.
68 var expectedError = "This item is already installed";
69 chrome.webstorePrivate.beginInstallWithManifest3(
70 {'id': extensionId, 'iconData': icon, 'manifest': manifest},
71 callbackFail(expectedError));
54 }); 72 });
55 } 73 }
56 ]; 74 ];
57 75
58 runTests(tests); 76 runTests(tests);
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/webstore_private.json ('k') | chrome/test/data/extensions/api_test/webstore_private/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698