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 function makeAbsoluteUrl(path
) {
6 var parts
= location
.href
.split("/");
9 return parts
.join("/");
12 // The |absoluteIconUrl| parameter controls whether to use a relative or
13 // absolute url for the test.
14 function runSuccessTest(absoluteIconUrl
, manifest
) {
15 var iconPath
= "extension/icon.png";
16 var iconUrl
= absoluteIconUrl
? makeAbsoluteUrl(iconPath
) : iconPath
;
18 {'id': extensionId
,'iconUrl': iconUrl
, 'manifest': manifest
},
23 function IconUrlFailure() {
24 var manifest
= getManifest();
25 var loadFailureUrl
= makeAbsoluteUrl("does_not_exist.png");
26 chrome
.webstorePrivate
.beginInstallWithManifest3(
27 {'id': extensionId
,'iconUrl': loadFailureUrl
, 'manifest': manifest
},
28 callbackFail("Image decode failed", function(result
) {
29 assertEq(result
, "icon_error");
33 function IconUrlSuccess() {
34 var manifest
= getManifest();
35 runSuccessTest(false, manifest
);
38 function IconUrlSuccessAbsoluteUrl() {
39 var manifest
= getManifest();
40 runSuccessTest(true, manifest
);