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

Unified Diff: chrome/browser/apps/app_url_redirector_browsertest.cc

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/browser/apps/app_url_redirector_browsertest.cc
diff --git a/chrome/browser/apps/app_url_redirector_browsertest.cc b/chrome/browser/apps/app_url_redirector_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..18408804631b0a827fe91d1e1dc765369167c2ae
--- /dev/null
+++ b/chrome/browser/apps/app_url_redirector_browsertest.cc
@@ -0,0 +1,66 @@
+// 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.
+
+#include "chrome/browser/apps/app_browsertest_util.h"
benwells 2013/09/09 05:48:39 You also need tests to cover navigation with a url
sergeygs 2013/09/09 09:55:36 Already did. See the most recent patch with new te
+
+namespace extensions {
+
+// Test that a click on a regular link in a tab launches an app that has
+// matching url_handlers.
+IN_PROC_BROWSER_TEST_F(PlatformAppUrlRedirectorBrowserTest,
+ ClickInTabIntercepted) {
+ TestNavigationInTab("url_handlers/launching_tabs/click_link.html",
+ "url_handlers/handler",
+ "Handler launched",
+ 1U);
benwells 2013/09/09 05:48:39 The InTab variants always have 1U, and the InApp v
sergeygs 2013/09/09 09:55:36 Already (re)done in a different way.
+}
+
+// Test that a click on a target='_blank' link in a tab launches an app that has
+// matching url_handlers.
+IN_PROC_BROWSER_TEST_F(PlatformAppUrlRedirectorBrowserTest,
+ BlankClickInTabIntercepted) {
+ TestNavigationInTab("url_handlers/launching_tabs/click_blank_link.html",
+ "url_handlers/handler",
+ "Handler launched",
+ 1U);
+}
+
+// Test that a call to window.open() in a tab launches an app that has
+// matching url_handlers.
+IN_PROC_BROWSER_TEST_F(PlatformAppUrlRedirectorBrowserTest,
+ WindowOpenInTabIntercepted) {
+ TestNavigationInTab("url_handlers/launching_tabs/call_window_open.html",
+ "url_handlers/handler",
+ "Handler launched",
+ 1U);
+}
+
+// Test that a click on target='_blank' link in an app window launches an app
+// that has matching url_handlers.
+IN_PROC_BROWSER_TEST_F(PlatformAppUrlRedirectorBrowserTest,
+ BlankClickInAppIntercepted) {
+ TestNavigationInApp("url_handlers/launcher",
+ "Launcher launched",
+ "url_handlers/handler",
+ "Handler launched",
+ 2U);
+}
+
+// Test that a webview in an app can be navigated to a URL without interception
+// even when there are other (or the same) apps that have matching url_handlers.
+IN_PROC_BROWSER_TEST_F(PlatformAppUrlRedirectorBrowserTest,
+ WebviewNavigationNotIntercepted) {
+ // The launcher clicks on a link, which gets intercepted and launches the
+ // handler. The handler also redirects an embedded webview to the URL. The
+ // webview should just navigate without creating an endless loop of
+ // navigate-intercept-launch sequences with multiplying handler's windows.
+ // There should be 2 windows only: launcher's and handler's.
+ TestNavigationInApp("url_handlers/launcher",
+ "Launcher launched",
+ "url_handlers/handler_with_webview",
+ "Handler launched",
+ 2U);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698