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

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

Issue 885443010: WebstorePrivate extension API cleanup, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testext_permission_prompt
Patch Set: remove dispatcher dependency Created 5 years, 10 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 function makeAbsoluteUrl(path) { 5 function makeAbsoluteUrl(path) {
6 var parts = location.href.split("/"); 6 var parts = location.href.split("/");
7 parts.pop(); 7 parts.pop();
8 parts.push(path); 8 parts.push(path);
9 return parts.join("/"); 9 return parts.join("/");
10 } 10 }
11 11
12 // The |absoluteIconUrl| parameter controls whether to use a relative or 12 // The |absoluteIconUrl| parameter controls whether to use a relative or
13 // absolute url for the test. 13 // absolute url for the test.
14 function runSuccessTest(absoluteIconUrl, manifest) { 14 function runSuccessTest(absoluteIconUrl, manifest) {
15 var iconPath = "extension/icon.png"; 15 var iconPath = "extension/icon.png";
16 var iconUrl = absoluteIconUrl ? makeAbsoluteUrl(iconPath) : iconPath; 16 var iconUrl = absoluteIconUrl ? makeAbsoluteUrl(iconPath) : iconPath;
17 installAndCleanUp( 17 installAndCleanUp(
18 {'id': extensionId,'iconUrl': iconUrl, 'manifest': manifest }, 18 {'id': extensionId,'iconUrl': iconUrl, 'manifest': manifest },
19 function() {}); 19 function() {});
20 } 20 }
21 21
22 var tests = [ 22 var tests = [
23 function IconUrlFailure() { 23 function IconUrlFailure() {
24 var manifest = getManifest(); 24 var manifest = getManifest();
25 var loadFailureUrl = makeAbsoluteUrl("does_not_exist.png"); 25 var loadFailureUrl = makeAbsoluteUrl("does_not_exist.png");
26 chrome.webstorePrivate.beginInstallWithManifest3( 26 chrome.webstorePrivate.beginInstallWithManifest3(
27 {'id': extensionId,'iconUrl': loadFailureUrl, 'manifest': manifest }, 27 {'id': extensionId,'iconUrl': loadFailureUrl, 'manifest': manifest },
28 callbackFail("Image decode failed", function(result) { 28 callbackFail("Image decode failed", function(result) {
29 assertEq(result, "icon_error"); 29 assertEq("icon_error", result);
30 })); 30 }));
31 }, 31 },
32 32
33 function IconUrlSuccess() { 33 function IconUrlSuccess() {
34 var manifest = getManifest(); 34 var manifest = getManifest();
35 runSuccessTest(false, manifest); 35 runSuccessTest(false, manifest);
36 }, 36 },
37 37
38 function IconUrlSuccessAbsoluteUrl() { 38 function IconUrlSuccessAbsoluteUrl() {
39 var manifest = getManifest(); 39 var manifest = getManifest();
40 runSuccessTest(true, manifest); 40 runSuccessTest(true, manifest);
41 } 41 }
42 ]; 42 ];
43 43
44 runTests(tests); 44 runTests(tests);
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/webstore_private/webstore_private_api.cc ('k') | extensions/browser/extension_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698