Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / webstore_private / accepted.js
blob780d3f33ae5462cb70399580c746b5fa1ca7ca88
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
3 // found in the LICENSE file.
5 // Tests where the beginInstallWithManifest3 dialog would be auto-accepted
6 // (including a few cases where this does not matter).
8 var tests = [
10 function completeBeforeBegin() {
11 var expectedError = extensionId +
12 " does not match a previous call to beginInstallWithManifest3";
13 chrome.webstorePrivate.completeInstall(extensionId,
14 callbackFail(expectedError));
17 function invalidID() {
18 var expectedError = "Invalid id";
19 var id = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
20 chrome.webstorePrivate.beginInstallWithManifest3(
21 { 'id':id, 'manifest':getManifest() }, callbackFail(expectedError));
24 function missingVersion() {
25 var manifestObj = JSON.parse(getManifest());
26 delete manifestObj["version"];
27 var manifest = JSON.stringify(manifestObj);
28 chrome.webstorePrivate.beginInstallWithManifest3(
29 { 'id':extensionId, 'manifest': manifest },
30 callbackFail("Invalid manifest", function(result) {
31 assertEq("manifest_error", result);
32 }));
35 function successfulInstall() {
36 // See things through all the way to a successful install.
37 listenOnce(chrome.management.onInstalled, function(info) {
38 assertEq(info.id, extensionId);
39 });
41 var manifest = getManifest();
42 getIconData(function(icon) {
43 installAndCleanUp(
44 {'id': extensionId, 'iconData': icon, 'manifest': manifest},
45 function() {});
46 });
49 function duplicateInstall() {
50 // See things through all the way to a successful install.
51 listenOnce(chrome.management.onInstalled, function(info) {
52 assertEq(info.id, extensionId);
53 });
55 var manifest = getManifest();
56 getIconData(function(icon) {
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 });
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));
72 });
76 runTests(tests);