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

Side by Side Diff: chrome/test/data/extensions/api_test/extension_gallery_install/test.html

Issue 4727001: Split the private webstore install API into two parts.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 <script src="common.js"></script>
1 <script> 2 <script>
2 // This tests that the management install and uninstall functions work 3 // This tests that the management beginInstall and completeInstall functions.
Erik does not do reviews 2010/11/10 16:47:45 "that the"?
asargent_no_longer_on_chrome 2010/11/10 22:58:23 fixed
3 // properly when called by the gallery. Additionally, it implicitly tests
4 // that the install() function, when called from the gallery, avoids the
5 // dangerous download prompt and the extension permissions install prompt.
6 // If either were to appear, this test wouldn't complete.
7 // Note that for the purposes of this test the gallery url is "www.a.com"
8 // which is set in extension_gallery_install_apitest.cc.
9 4
10 var id = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; 5 // Register a listener for when the install is completed.
6 chrome.management.onInstalled.addListener(function(info) {
7 assertEq(info.id, extension_id);
8 succeed();
9 });
11 10
12 function checkInstalled(callback) { 11 // Make sure our extension isn't yet installed.
13 chrome.management.getAll(function(extensions) { 12 checkInstalled(function(installed) {
14 var found = false; 13 assertEq(false, installed);
15 extensions.forEach(function(extension) {
16 if (id == extension.id)
17 found = true;
18 });
19
20 callback(found);
21 });
22 }
23 14
24 // Make sure our "gallery" extension isn't yet installed. 15 // Begin installing.
25 checkInstalled(function(installed) { 16 chrome.webstorePrivate.beginInstall(extension_id, function() {
26 chrome.test.assertEq(false, installed); 17 assertNoLastError();
27 18
28 // Install "gallery" extensions. 19 // Now complete the installation.
29 chrome.management.onInstalled.addListener(function(info) { 20 chrome.webstorePrivate.completeInstall(extension_id, function() {
30 chrome.test.assertEq(id, info.id); 21 assertNoLastError();
31 console.log("Installed " + info.id);
32
33 // Double check it is installed.
34 checkInstalled(function(installed) {
35 chrome.test.assertEq(true, installed);
36
37 // Now uninstall
38 chrome.management.onUninstalled.addListener(function() {
39 // And check that it's gone.
40 checkInstalled(function(installed) {
41 chrome.test.assertEq(false, installed);
42
43 chrome.test.succeed();
44 });
45 });
46
47 console.log("Uninstalling...");
48 chrome.management.uninstall(id, function() {
49 chrome.test.assertNoLastError();
50 });
51 }); 22 });
52 }); 23 });
53 chrome.webstorePrivate.install(id, function() {
54 chrome.test.assertNoLastError();
55 });
56 console.log("Installing...");
57 }); 24 });
58 </script> 25 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698