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

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

Issue 7621032: Initial inline web store install bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback. Created 9 years, 4 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
Index: chrome/test/data/extensions/api_test/webstore_inline_install/find_link.html
diff --git a/chrome/test/data/extensions/api_test/webstore_inline_install/find_link.html b/chrome/test/data/extensions/api_test/webstore_inline_install/find_link.html
new file mode 100644
index 0000000000000000000000000000000000000000..a8ceb28247937757b219154e571b849111b22113
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webstore_inline_install/find_link.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<script>
+ var NO_LINK_EXCEPTION = 'No Chrome Web Store item link found.';
+ var INVALID_URL_EXCEPTION = 'Invalid Chrome Web Store item URL.';
+
+ function checkNoLinkFound(expectedException) {
+ try {
+ chrome.webstore.install();
+ console.log('Exception should have been thrown');
+ window.domAutomationController.send(false);
+ return;
+ } catch (err) {
+ if (err != expectedException) {
+ console.log('Unexpected exception thrown: ' + err);
+ window.domAutomationController.send(false);
+ }
+ }
+ }
+
+ function runTest() {
+ // Definitely no link.
+ checkNoLinkFound(NO_LINK_EXCEPTION);
+
+ // Empty link.
+ var linkNode = document.createElement('link');
+ document.getElementsByTagName('head')[0].appendChild(linkNode);
+ checkNoLinkFound(NO_LINK_EXCEPTION);
+
+ // Wrong type, right URL.
+ linkNode.rel = 'stylesheet';
+ linkNode.href = 'http://cws.com/detail/abc';
+ checkNoLinkFound(NO_LINK_EXCEPTION);
+
+ // Right type, wrong URL.
+ linkNode.rel = 'chrome-webstore-item';
+ linkNode.href = 'http://app.com/detail/abc';
+ checkNoLinkFound(INVALID_URL_EXCEPTION);
+
+ // Non-item CWS URL
+ linkNode.href = 'http://cws.com/someotherpage/abc';
+ checkNoLinkFound(INVALID_URL_EXCEPTION);
+
+ // Extra CWS URL parameters
+ linkNode.href = 'http://cws.com/detail/abc?foo=bar';
+ checkNoLinkFound(INVALID_URL_EXCEPTION);
+
+ // Successful installation is tested elsewhere
+ window.domAutomationController.send(true);
+ }
+</script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698