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

Unified Diff: chrome/test/data/extensions/platform_apps/url_handlers/launching_pages/navigate.js

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a few TODOs Created 7 years, 3 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/platform_apps/url_handlers/launching_pages/navigate.js
diff --git a/chrome/test/data/extensions/platform_apps/url_handlers/launching_pages/navigate.js b/chrome/test/data/extensions/platform_apps/url_handlers/launching_pages/navigate.js
new file mode 100644
index 0000000000000000000000000000000000000000..865b91e5403f61fe2a855069cd70df89757ad1b4
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/url_handlers/launching_pages/navigate.js
@@ -0,0 +1,35 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+ var target_dir = '/extensions/platform_apps/url_handlers/common/';
+ var link = document.getElementById('link');
+ var mismatching_link = document.getElementById('mismatching_link');
+
+ if (link || mismatching_link) {
+ var clickEvent = document.createEvent('MouseEvents');
+ clickEvent.initMouseEvent('click', true, true, window,
+ 0, 0, 0, 0, 0, false, false,
+ false, false, 0, null);
+ if (link) {
+ console.log("Clicking a matching link");
+ link.href = target_dir + 'target.html';
+ // This click should open the handler app (pre-installed in the browser by
+ // the CPP test before launching this) with link.href.
+ link.dispatchEvent(clickEvent);
+ }
+
+ if (mismatching_link) {
+ console.log("Clicking a mismatching link");
+ mismatching_link.href = target_dir + 'mismatching_target.html';
+ // This click should NOT open the handler app, because the URL does not
+ // match the url_handlers of the app. It should open the link in a new
+ // tab instead.
+ mismatching_link.dispatchEvent(clickEvent);
+ }
+ } else {
+ console.log("Calling window.open()");
+ window.open(target_dir + 'target.html');
+ }
+})();

Powered by Google App Engine
This is Rietveld 408576698