blob: b2da0b0d8153c56bc3ccfe0b5d485ef92bd3d6dc [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<link rel="chrome-webstore-item">
</head>
<body>
<script>
function runTest(galleryUrl) {
var receivedProgressUpdate = false;
// 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.onDownloadProgress.addListener(function(progress) {
if (progress < 0 || progress > 1.0) {
console.log('Received invalid download progress: ' + progress);
window.domAutomationController.send(false);
}
receivedProgressUpdate = true;
});
chrome.webstore.install(
undefined,
function() {
if (!receivedProgressUpdate) {
console.log(
'Test Failed: Did not receive download progress update.');
window.domAutomationController.send(false);
}
window.domAutomationController.send(true);
},
function(error) {
console.log('Unexpected error: ' + error);
window.domAutomationController.send(false);
});
// Force a garbage collection, so that if the callbacks aren't being
// retained properly they'll get collected and the test will fail.
window.gc();
} catch (e) {
console.log('Unexpected exception: ' + e);
console.log(e.stack);
window.domAutomationController.send(false);
throw e;
}
}
</script>
</body>
</html>