summaryrefslogtreecommitdiff
path: root/chromium/content/common/navigation_params_unittest.cc
blob: ee1f96a68e0f890529f18b60a8a4e1254bffa109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 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 "content/common/navigation_params.h"

#include "content/public/common/browser_side_navigation_policy.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace content {

TEST(NavigationParamsTest, ShouldMakeNetworkRequestForURL) {
  if (!IsBrowserSideNavigationEnabled())
    return;

  EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("http://foo/bar.html")));
  EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("https://foo/bar.html")));
  EXPECT_TRUE(ShouldMakeNetworkRequestForURL(GURL("data://foo")));

  EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:blank")));
  EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("about:srcdoc")));
  EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("javascript://foo.js")));
  EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL("cid:foo@bar")));
  EXPECT_FALSE(ShouldMakeNetworkRequestForURL(GURL()));
}

}  // namespace content