| 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>
|
|
|