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

Unified Diff: chrome/browser/chromeos/arc/arc_navigation_throttle_unittest.cc

Issue 2277533002: Open |current_url| in Chrome when |previous_url| is empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Xiyuan's comment Created 4 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_navigation_throttle_unittest.cc
diff --git a/chrome/browser/chromeos/arc/arc_navigation_throttle_unittest.cc b/chrome/browser/chromeos/arc/arc_navigation_throttle_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..759a2556d52aed6728419f39f72b657e2bf96e0e
--- /dev/null
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2016 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/chromeos/arc/arc_navigation_throttle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace arc {
+
+TEST(ArcNavigationThrottleTest, TestShouldOverrideUrlLoading) {
+ // A navigation within the same domain shouldn't be overridden.
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://google.com"), GURL("http://google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://google.com"), GURL("http://a.google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://a.google.com"), GURL("http://google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://a.google.com"), GURL("http://b.google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://a.google.com"), GURL("http://b.c.google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://a.b.google.com"), GURL("http://c.google.com/")));
+
+ // If either of two paramters is empty, the function should return false.
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL(), GURL("http://a.google.com/")));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://a.google.com/"), GURL()));
+ EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL(), GURL()));
+
+ // A navigation not within the same domain can be overridden.
+ EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://www.google.com"), GURL("http://www.not-google.com/")));
+ EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting(
+ GURL("http://www.not-google.com"), GURL("http://www.google.com/")));
+}
+
+} // namespace arc
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698