Chromium Code Reviews| 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..580f35a098819f418438ca572a37e9f139373abb |
| --- /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 overwridden. |
|
Ben Kwa
2016/09/20 21:28:30
nit: "overridden"
Yusuke Sato
2016/09/20 22:16:09
Done.
|
| + 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 fucntion should return false. |
|
Ben Kwa
2016/09/20 21:28:30
nit: "function"
Yusuke Sato
2016/09/20 22:16:09
Done.
|
| + 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. |
|
Ben Kwa
2016/09/20 21:28:30
suggest: "can be overridden"
Yusuke Sato
2016/09/20 22:16:09
Done.
|
| + 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 |