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

Side by Side Diff: url/url_util_unittest.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Added unit test Created 3 years, 11 months 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
« url/url_util.h ('K') | « url/url_util.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/third_party/mozilla/url_parse.h" 9 #include "url/third_party/mozilla/url_parse.h"
10 #include "url/url_canon.h" 10 #include "url/url_canon.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 SCOPED_TRACE(testing::Message() << "(host, domain): (" 410 SCOPED_TRACE(testing::Message() << "(host, domain): ("
411 << test_case.canonicalized_host << ", " 411 << test_case.canonicalized_host << ", "
412 << test_case.lower_ascii_domain << ")"); 412 << test_case.lower_ascii_domain << ")");
413 413
414 EXPECT_EQ( 414 EXPECT_EQ(
415 test_case.expected_domain_is, 415 test_case.expected_domain_is,
416 DomainIs(test_case.canonicalized_host, test_case.lower_ascii_domain)); 416 DomainIs(test_case.canonicalized_host, test_case.lower_ascii_domain));
417 } 417 }
418 } 418 }
419 419
420 TEST(URLUtilTest, IsAboutBlank) {
421 const std::string kAboutBlankURLS[] = {"about:blank", "about:blank?foo",
Charlie Reis 2017/01/20 20:31:02 Minor nit: Lowercase s at the end (kAboutBlankURLs
clamy 2017/01/23 12:26:27 Done.
422 "about:blank/#foo",
423 "about:blank?foo#foo"};
424 for (const auto& url : kAboutBlankURLS)
425 EXPECT_TRUE(IsAboutBlank(GURL(url)));
426
427 const std::string kNotAboutBlankURLS[] = {
428 "http:blank", "about:blan", "about://blank",
429 "about:blank/foo", "about://:8000/blank", "about://foo:foo@/blank"};
Charlie Reis 2017/01/20 20:31:02 A few more to add: foo@about:blank foo:bar@about:b
clamy 2017/01/23 12:26:27 Done.
430 for (const auto& url : kNotAboutBlankURLS)
431 EXPECT_FALSE(IsAboutBlank(GURL(url)));
432 }
433
420 } // namespace url 434 } // namespace url
OLDNEW
« url/url_util.h ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698