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

Unified Diff: chrome/test/data/extensions/api_test/extension_gallery_install/test.html

Issue 3353015: Implement gallery install API (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: erik comments Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/extension_gallery_install/test.html
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/test.html b/chrome/test/data/extensions/api_test/extension_gallery_install/test.html
new file mode 100644
index 0000000000000000000000000000000000000000..ffd5f977a4f5acfcd787a103c3f41978d9c6592d
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/extension_gallery_install/test.html
@@ -0,0 +1,58 @@
+<script>
+// This tests that the management install and uninstall functions work
+// properly when called by the gallery. Additionally, it implicitly tests
+// that the install() function, when called from the gallery, avoids the
+// dangerous download prompt and the extension permissions install prompt.
+// If either were to appear, this test wouldn't complete.
+// Note that for the purposes of this test the gallery url is "www.a.com"
+// which is set in extension_gallery_install_apitest.cc.
+
+var id = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
+
+function checkInstalled(callback) {
+ chrome.experimental.management.getAll(function(extensions) {
+ var found = false;
+ extensions.forEach(function(extension) {
+ if (id == extension.id)
+ found = true;
+ });
+
+ callback(found);
+ });
+}
+
+// Make sure our "gallery" extension isn't yet installed.
+checkInstalled(function(installed) {
+ chrome.test.assertEq(false, installed);
+
+ // Install "gallery" extensions.
+ chrome.experimental.management.onInstalled.addListener(function(info) {
+ chrome.test.assertEq(id, info.id);
+ console.log("Installed " + info.id);
+
+ // Double check it is installed.
+ checkInstalled(function(installed) {
+ chrome.test.assertEq(true, installed);
+
+ // Now uninstall
+ chrome.experimental.management.onUninstalled.addListener(function() {
+ // And check that it's gone.
+ checkInstalled(function(installed) {
+ chrome.test.assertEq(false, installed);
+
+ chrome.test.succeed();
+ });
+ });
+
+ console.log("Uninstalling...");
+ chrome.experimental.management.uninstall(id, function() {
+ chrome.test.assertNoLastError();
+ });
+ });
+ });
+ chrome.webstorePrivate.install(id, function() {
+ chrome.test.assertNoLastError();
+ });
+ console.log("Installing...");
+});
+</script>
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698