OLD | NEW |
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 Loading... |
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); |
OLD | NEW |