Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Side by Side Diff: url/gurl_unittest.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « url/gurl.cc ('k') | url/origin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 struct TestCase { 336 struct TestCase {
337 const char* input; 337 const char* input;
338 const char* expected; 338 const char* expected;
339 } cases[] = { 339 } cases[] = {
340 {"http://www.google.com", "http://www.google.com/"}, 340 {"http://www.google.com", "http://www.google.com/"},
341 {"http://user:pass@www.google.com:21/blah#baz", "http://www.google.com:21/bl ah"}, 341 {"http://user:pass@www.google.com:21/blah#baz", "http://www.google.com:21/bl ah"},
342 {"http://user@www.google.com", "http://www.google.com/"}, 342 {"http://user@www.google.com", "http://www.google.com/"},
343 {"http://:pass@www.google.com", "http://www.google.com/"}, 343 {"http://:pass@www.google.com", "http://www.google.com/"},
344 {"http://:@www.google.com", "http://www.google.com/"}, 344 {"http://:@www.google.com", "http://www.google.com/"},
345 {"http://www.google.com/temp/foo?q#b", "http://www.google.com/temp/foo?q"}, 345 {"http://www.google.com/temp/foo?q#b", "http://www.google.com/temp/foo?q"},
346 {"not a url", ""},
347 {"unknown-scheme://foo.html", ""},
348 {"file:///tmp/test.html", ""},
349 {"https://www.google.com", "https://www.google.com/"},
346 }; 350 };
347 for (size_t i = 0; i < arraysize(cases); i++) { 351 for (size_t i = 0; i < arraysize(cases); i++) {
348 GURL url(cases[i].input); 352 GURL url(cases[i].input);
349 GURL origin = url.GetAsReferrer(); 353 GURL origin = url.GetAsReferrer();
350 EXPECT_EQ(cases[i].expected, origin.spec()); 354 EXPECT_EQ(cases[i].expected, origin.spec());
351 } 355 }
352 } 356 }
353 357
354 TEST(GURLTest, GetWithEmptyPath) { 358 TEST(GURLTest, GetWithEmptyPath) {
355 struct TestCase { 359 struct TestCase {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS()); 633 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS());
630 } 634 }
631 635
632 TEST(GURLTest, SchemeIsBlob) { 636 TEST(GURLTest, SchemeIsBlob) {
633 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob()); 637 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob());
634 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob()); 638 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob());
635 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob()); 639 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob());
636 } 640 }
637 641
638 } // namespace url 642 } // namespace url
OLDNEW
« no previous file with comments | « url/gurl.cc ('k') | url/origin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698