OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/navigation_params.h" | 5 #include "content/common/navigation_params.h" |
6 | 6 |
7 #include "content/public/common/browser_side_navigation_policy.h" | 7 #include "content/public/common/browser_side_navigation_policy.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 TEST(NavigationParamsTest, ShouldMakeNetworkRequestForURL) { | 13 TEST(NavigationParamsTest, ShouldMakeNetworkRequestForURL) { |
14 if (!IsBrowserSideNavigationEnabled()) | 14 if (!IsBrowserSideNavigationEnabled()) |
15 return; | 15 return; |
16 | 16 |
17 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("http://foo/bar.html"))); | 17 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("http://foo/bar.html"))); |
18 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("https://foo/bar.html"))); | 18 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("https://foo/bar.html"))); |
19 // Even though a "data" url doesn't generate actual network requests. It is | |
nasko
2017/05/04 15:48:18
nit: "data:", since it is a scheme. "requests, it
arthursonzogni
2017/05/05 09:07:46
I will list some reasons why some data-urls requir
| |
20 // handled by the network stack and so must return true for this check. | |
19 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("data://foo"))); | 21 EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("data://foo"))); |
20 | 22 |
21 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:blank"))); | 23 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:blank"))); |
22 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:srcdoc"))); | 24 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:srcdoc"))); |
23 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("javascript://foo.js"))); | 25 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("javascript://foo.js"))); |
24 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("cid:foo@bar"))); | 26 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("cid:foo@bar"))); |
25 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL())); | 27 EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL())); |
26 } | 28 } |
27 | 29 |
28 } // namespace content | 30 } // namespace content |
OLD | NEW |