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

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

Issue 8430033: Adds a webstorePrivate method for silently installing extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mihai Created 9 years, 1 month 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 | Annotate | Revision Log
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 // The id of an extension we're using for install tests. 5 // The id of an extension we're using for install tests.
6 var extensionId = "enfkhcelefdadlmkffamgdlgplcionje"; 6 var extensionId = "enfkhcelefdadlmkffamgdlgplcionje";
7 7
8 // The id of an app we're using for install tests. 8 // The id of an app we're using for install tests.
9 var appId = "iladmdjkfniedhfhcfoefgojhgaiaccc"; 9 var appId = "iladmdjkfniedhfhcfoefgojhgaiaccc";
10 10
11 var assertEq = chrome.test.assertEq; 11 var assertEq = chrome.test.assertEq;
12 var assertNoLastError = chrome.test.assertNoLastError; 12 var assertNoLastError = chrome.test.assertNoLastError;
13 var assertTrue = chrome.test.assertTrue;
13 var callbackFail = chrome.test.callbackFail; 14 var callbackFail = chrome.test.callbackFail;
14 var callbackPass = chrome.test.callbackPass; 15 var callbackPass = chrome.test.callbackPass;
15 var listenOnce = chrome.test.listenOnce; 16 var listenOnce = chrome.test.listenOnce;
16 var runTests = chrome.test.runTests; 17 var runTests = chrome.test.runTests;
17 var succeed = chrome.test.succeed; 18 var succeed = chrome.test.succeed;
18 19
20 // Calls |callback| with true/false indicating whether an item with the |id|
21 // is installed.
22 function checkItemInstalled(id, callback) {
23 chrome.management.getAll(function(extensions) {
24 callback(extensions.some(function(ext) {
25 return ext.id == id;
26 }));
27 });
28 }
29
19 // Calls |callback| with true/false indicating whether an item with an id of 30 // Calls |callback| with true/false indicating whether an item with an id of
20 // extensionId is installed. 31 // extensionId is installed.
21 function checkInstalled(callback) { 32 function checkInstalled(callback) {
22 chrome.management.getAll(function(extensions) { 33 checkItemInstalled(extensionId, callback);
23 callback(extensions.some(function(ext) {
24 return ext.id == extensionId;
25 }));
26 });
27 } 34 }
28 35
29 var cachedIcon = null; 36 var cachedIcon = null;
30 var img = null; 37 var img = null;
31 38
32 // This returns the base64-encoded content of the extension's image. 39 // This returns the base64-encoded content of the extension's image.
33 function getIconData(callback) { 40 function getIconData(callback) {
34 if (cachedIcon) { 41 if (cachedIcon) {
35 callback(cachedIcon); 42 callback(cachedIcon);
36 } 43 }
(...skipping 22 matching lines...) Expand all
59 return cachedManifest; 66 return cachedManifest;
60 67
61 // Do a synchronous XHR to get the manifest. 68 // Do a synchronous XHR to get the manifest.
62 var xhr = new XMLHttpRequest(); 69 var xhr = new XMLHttpRequest();
63 xhr.open("GET", 70 xhr.open("GET",
64 alternativePath ? alternativePath : "extension/manifest.json", 71 alternativePath ? alternativePath : "extension/manifest.json",
65 false); 72 false);
66 xhr.send(null); 73 xhr.send(null);
67 return xhr.responseText; 74 return xhr.responseText;
68 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698