Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/arc/arc_navigation_throttle.h" | |
| 6 #include "testing/gtest/include/gtest/gtest.h" | |
| 7 #include "url/gurl.h" | |
| 8 | |
| 9 namespace arc { | |
| 10 | |
| 11 TEST(ArcNavigationThrottleTest, TestShouldOverrideUrlLoading) { | |
| 12 // A navigation within the same domain shouldn't be overwridden. | |
|
Ben Kwa
2016/09/20 21:28:30
nit: "overridden"
Yusuke Sato
2016/09/20 22:16:09
Done.
| |
| 13 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 14 GURL("http://google.com"), GURL("http://google.com/"))); | |
| 15 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 16 GURL("http://google.com"), GURL("http://a.google.com/"))); | |
| 17 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 18 GURL("http://a.google.com"), GURL("http://google.com/"))); | |
| 19 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 20 GURL("http://a.google.com"), GURL("http://b.google.com/"))); | |
| 21 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 22 GURL("http://a.google.com"), GURL("http://b.c.google.com/"))); | |
| 23 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 24 GURL("http://a.b.google.com"), GURL("http://c.google.com/"))); | |
| 25 | |
| 26 // If either of two paramters is empty, the fucntion should return false. | |
|
Ben Kwa
2016/09/20 21:28:30
nit: "function"
Yusuke Sato
2016/09/20 22:16:09
Done.
| |
| 27 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 28 GURL(), GURL("http://a.google.com/"))); | |
| 29 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 30 GURL("http://a.google.com/"), GURL())); | |
| 31 EXPECT_FALSE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 32 GURL(), GURL())); | |
| 33 | |
| 34 // A navigation not within the same domain can be. | |
|
Ben Kwa
2016/09/20 21:28:30
suggest: "can be overridden"
Yusuke Sato
2016/09/20 22:16:09
Done.
| |
| 35 EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 36 GURL("http://www.google.com"), GURL("http://www.not-google.com/"))); | |
| 37 EXPECT_TRUE(ArcNavigationThrottle::ShouldOverrideUrlLoadingForTesting( | |
| 38 GURL("http://www.not-google.com"), GURL("http://www.google.com/"))); | |
| 39 } | |
| 40 | |
| 41 } // namespace arc | |
| OLD | NEW |