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

Unified Diff: chrome/test/data/extensions/api_test/webstore_inline_install/double_install.html

Issue 2103663002: [Extensions] Rework inline installation observation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missingfile Created 4 years, 6 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/webstore_install_result.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/webstore_inline_install/double_install.html
diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/double_install.html b/chrome/test/data/extensions/api_test/webstore_inline_install/double_install.html
new file mode 100644
index 0000000000000000000000000000000000000000..8007f6f4d9b0251b770f6a08503250cab4de25e5
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webstore_inline_install/double_install.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="chrome-webstore-item">
+</head>
+<body>
+<script>
+ function runTest(galleryUrl) {
+ // Link URL has to be generated dynamically in order to include the right
+ // port number. The ID corresponds to the data in the "extension" directory.
+ document.getElementsByTagName('link')[0].href =
+ galleryUrl + '/detail/ecglahbcnmdpdciemllbhojghbkagdje';
+
+ try {
+ chrome.webstore.install(
+ undefined,
+ function() {},
+ function() {});
+ chrome.webstore.install(
+ undefined,
+ function() {
+ console.log('Unexpected success');
+ window.domAutomationController.send(false);
+ },
+ function(errorMessage, errorCode) {
+ var success = errorCode == 3; // Install in progress error.
+ if (!success)
+ console.log('Unexpected error: ' + errorMessage);
+ window.domAutomationController.send(success);
+ });
+ } catch (e) {
+ // Yuck. We can throw this "already installing" error either from the
+ // renderer (if we catch the fact that it's already installing early) or
+ // from the browser. In the first case, it's a thrown error, and in the
+ // second, it triggers the callback from chrome.webstore.install. And to
+ // top it off, they're different messages. Unfortunately, it's hard to say
+ // which, if either, we can change, since someone may be relying on one or
+ // the other.
+ // TODO(devlin): Make this less bad somehow. crbug.com/624614
+ var success =
+ e.message == 'A Chrome Web Store installation is already pending.';
+ if (!success)
+ console.log('Unexpected exception: ' + e);
+ window.domAutomationController.send(success);
+ }
+ }
+</script>
+
+</body>
+</html>
« no previous file with comments | « chrome/common/extensions/webstore_install_result.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698