| Index: chrome/test/data/extensions/api_test/webstore_inline_install/argument_validation.html
|
| diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/argument_validation.html b/chrome/test/data/extensions/api_test/webstore_inline_install/argument_validation.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9b87ba13f97798bc8dd488fbce541613c6b109ae
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/webstore_inline_install/argument_validation.html
|
| @@ -0,0 +1,71 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| + <link rel="chrome-webstore-item">
|
| +</head>
|
| +<body>
|
| +<script>
|
| + function runTest(galleryUrl) {
|
| + var storeUrl = galleryUrl + '/detail/ecglahbcnmdpdciemllbhojghbkagdje';
|
| + // 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 = storeUrl;
|
| +
|
| + function runTests(tests) {
|
| + var failed = false;
|
| + tests.forEach(function(test) {
|
| + if (test.shouldPass) {
|
| + try {
|
| + test.func();
|
| + } catch (e) {
|
| + alert('unexpected exception: ' + e);
|
| + failed = true;
|
| + }
|
| + } else {
|
| + try {
|
| + test.func();
|
| + alert('unexpected pass: ' + func);
|
| + failed = true;
|
| + } catch (e) {
|
| + // Expected exception
|
| + }
|
| + }
|
| + });
|
| +
|
| + window.domAutomationController.send(!failed);
|
| + }
|
| +
|
| + function shouldPass(func) {
|
| + return {
|
| + func: func,
|
| + shouldPass: true
|
| + }
|
| + }
|
| +
|
| + function shouldFail(func) {
|
| + return {
|
| + func: func,
|
| + shouldPass: false
|
| + }
|
| + }
|
| +
|
| + var cwi = chrome.webstore.install;
|
| + runTests([
|
| + shouldPass(function() {cwi()}),
|
| + shouldPass(function() {cwi(undefined)}),
|
| + shouldPass(function() {cwi(undefined, undefined)}),
|
| + shouldPass(function() {cwi(undefined, undefined, undefined)}),
|
| +
|
| + shouldPass(function() {cwi(storeUrl)}),
|
| + shouldPass(function() {cwi(undefined, function() {})}),
|
| + shouldPass(function() {cwi(undefined, undefined, function() {})}),
|
| +
|
| + shouldFail(function() {cwi(123)}),
|
| + shouldFail(function() {cwi(undefined, 123)}),
|
| + shouldFail(function() {cwi(undefined, undefined, 123)})
|
| + ]);
|
| + }
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|