| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "url/gurl.h" | 7 #include "url/gurl.h" |
| 8 #include "url/url_canon.h" | 8 #include "url/url_canon.h" |
| 9 #include "url/url_test_utils.h" | 9 #include "url/url_test_utils.h" |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // The tricky cases for relative URL resolving are tested in the | 274 // The tricky cases for relative URL resolving are tested in the |
| 275 // canonicalizer unit test. Here, we just test that the GURL integration | 275 // canonicalizer unit test. Here, we just test that the GURL integration |
| 276 // works properly. | 276 // works properly. |
| 277 struct ResolveCase { | 277 struct ResolveCase { |
| 278 const char* base; | 278 const char* base; |
| 279 const char* relative; | 279 const char* relative; |
| 280 bool expected_valid; | 280 bool expected_valid; |
| 281 const char* expected; | 281 const char* expected; |
| 282 } resolve_cases[] = { | 282 } resolve_cases[] = { |
| 283 {"http://www.google.com/", "foo.html", true, "http://www.google.com/foo.html
"}, | 283 {"http://www.google.com/", "foo.html", true, "http://www.google.com/foo.html
"}, |
| 284 {"http://www.google.com/foo/", "bar", true, "http://www.google.com/foo/bar"}
, |
| 285 {"http://www.google.com/foo/", "/bar", true, "http://www.google.com/bar"}, |
| 286 {"http://www.google.com/foo", "bar", true, "http://www.google.com/bar"}, |
| 284 {"http://www.google.com/", "http://images.google.com/foo.html", true, "http:
//images.google.com/foo.html"}, | 287 {"http://www.google.com/", "http://images.google.com/foo.html", true, "http:
//images.google.com/foo.html"}, |
| 285 {"http://www.google.com/blah/bloo?c#d", "../../../hello/./world.html?a#b", t
rue, "http://www.google.com/hello/world.html?a#b"}, | 288 {"http://www.google.com/blah/bloo?c#d", "../../../hello/./world.html?a#b", t
rue, "http://www.google.com/hello/world.html?a#b"}, |
| 286 {"http://www.google.com/foo#bar", "#com", true, "http://www.google.com/foo#c
om"}, | 289 {"http://www.google.com/foo#bar", "#com", true, "http://www.google.com/foo#c
om"}, |
| 287 {"http://www.google.com/", "Https:images.google.com", true, "https://images.
google.com/"}, | 290 {"http://www.google.com/", "Https:images.google.com", true, "https://images.
google.com/"}, |
| 288 // A non-standard base can be replaced with a standard absolute URL. | 291 // A non-standard base can be replaced with a standard absolute URL. |
| 289 {"data:blahblah", "http://google.com/", true, "http://google.com/"}, | 292 {"data:blahblah", "http://google.com/", true, "http://google.com/"}, |
| 290 {"data:blahblah", "http:google.com", true, "http://google.com/"}, | 293 {"data:blahblah", "http:google.com", true, "http://google.com/"}, |
| 291 // Filesystem URLs have different paths to test. | 294 // Filesystem URLs have different paths to test. |
| 292 {"filesystem:http://www.google.com/type/", "foo.html", true, "filesystem:htt
p://www.google.com/type/foo.html"}, | 295 {"filesystem:http://www.google.com/type/", "foo.html", true, "filesystem:htt
p://www.google.com/type/foo.html"}, |
| 293 {"filesystem:http://www.google.com/type/", "../foo.html", true, "filesystem:
http://www.google.com/type/foo.html"}, | 296 {"filesystem:http://www.google.com/type/", "../foo.html", true, "filesystem:
http://www.google.com/type/foo.html"}, |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS()); | 636 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS()); |
| 634 } | 637 } |
| 635 | 638 |
| 636 TEST(GURLTest, SchemeIsBlob) { | 639 TEST(GURLTest, SchemeIsBlob) { |
| 637 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob()); | 640 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob()); |
| 638 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob()); | 641 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob()); |
| 639 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob()); | 642 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob()); |
| 640 } | 643 } |
| 641 | 644 |
| 642 } // namespace url | 645 } // namespace url |
| OLD | NEW |