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

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> 1 <script>
2 // This tests that the management install and uninstall functions work 2 // This tests that the management install and uninstall functions work
3 // properly when called by the gallery. Additionally, it implicitly tests 3 // properly when called by the gallery. Additionally, it implicitly tests
4 // that the install() function, when called from the gallery, avoids the 4 // that the install() function, when called from the gallery, avoids the
5 // dangerous download prompt and the extension permissions install prompt. 5 // dangerous download prompt and the extension permissions install prompt.
6 // If either were to appear, this test wouldn't complete. 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" 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. 8 // which is set in extension_gallery_install_apitest.cc.
9 9
10 var id = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; 10 var id = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
11 11
12 function checkInstalled(callback) { 12 function checkInstalled(callback) {
13 chrome.management.getAll(function(extensions) { 13 chrome.management.getAll(function(extensions) {
14 var found = false; 14 var found = false;
15 extensions.forEach(function(extension) { 15 extensions.forEach(function(extension) {
16 if (id == extension.id) 16 if (id == extension.id)
17 found = true; 17 found = true;
18 }); 18 });
19 19
20 callback(found); 20 callback(found);
21 }); 21 });
22 } 22 }
23 23
24 // Make sure our "gallery" extension isn't yet installed. 24 // Make sure our "gallery" extension isn't yet installed.
25 checkInstalled(function(installed) { 25 checkInstalled(function(installed) {
26 chrome.test.assertEq(false, installed); 26 chrome.test.assertEq(false, installed);
27 27
28 // Install "gallery" extensions. 28 // Install "gallery" extensions.
29 chrome.management.onInstalled.addListener(function(info) { 29 chrome.management.onInstalled.addListener(function(info) {
30 chrome.test.assertEq(id, info.id); 30 chrome.test.assertEq(id, info.id);
31 console.log("Installed " + info.id); 31 console.log("Installed " + info.id);
32 32
33 // Double check it is installed. 33 // Double check it is installed.
34 checkInstalled(function(installed) { 34 checkInstalled(function(installed) {
35 chrome.test.assertEq(true, installed); 35 chrome.test.assertEq(true, installed);
36 36
37 // Now uninstall 37 // Now uninstall
38 chrome.management.onUninstalled.addListener(function() { 38 chrome.management.onUninstalled.addListener(function() {
39 // And check that it's gone. 39 // And check that it's gone.
40 checkInstalled(function(installed) { 40 checkInstalled(function(installed) {
41 chrome.test.assertEq(false, installed); 41 chrome.test.assertEq(false, installed);
42 42
43 chrome.test.succeed(); 43 chrome.test.succeed();
44 }); 44 });
45 }); 45 });
46 46
47 console.log("Uninstalling..."); 47 console.log("Uninstalling...");
48 chrome.management.uninstall(id, function() { 48 chrome.management.uninstall(id, function() {
49 chrome.test.assertNoLastError(); 49 chrome.test.assertNoLastError();
50 }); 50 });
51 }); 51 });
52 }); 52 });
53 chrome.webstorePrivate.install(id, function() { 53 chrome.webstorePrivate.beginInstall(id, function() {
54 if (window.location.href.indexOf("expect_error=true") > 0) {
55 chrome.test.assertEq(chrome.extension.lastError.message,
56 "This function must be called during a user gesture");
57 chrome.test.succeed();
58 return;
59 }
54 chrome.test.assertNoLastError(); 60 chrome.test.assertNoLastError();
61 chrome.webstorePrivate.completeInstall(id, function() {
Erik does not do reviews 2010/11/09 16:32:21 seems like you need a couple of tests that call co
asargent_no_longer_on_chrome 2010/11/10 00:23:48 I've simplified this test and added others to cove
62 chrome.test.assertNoLastError();
63 });
55 }); 64 });
56 console.log("Installing..."); 65 console.log("Installing...");
57 }); 66 });
58 </script> 67 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698