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

Side by Side Diff: url/url_util_unittest.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Add missing include 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/gurl.h"
9 #include "url/third_party/mozilla/url_parse.h" 10 #include "url/third_party/mozilla/url_parse.h"
10 #include "url/url_canon.h" 11 #include "url/url_canon.h"
11 #include "url/url_canon_stdstring.h" 12 #include "url/url_canon_stdstring.h"
12 #include "url/url_test_utils.h" 13 #include "url/url_test_utils.h"
13 #include "url/url_util.h" 14 #include "url/url_util.h"
14 15
15 namespace url { 16 namespace url {
16 17
17 TEST(URLUtilTest, FindAndCompareScheme) { 18 TEST(URLUtilTest, FindAndCompareScheme) {
18 Component found_scheme; 19 Component found_scheme;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 SCOPED_TRACE(testing::Message() << "(host, domain): (" 411 SCOPED_TRACE(testing::Message() << "(host, domain): ("
411 << test_case.canonicalized_host << ", " 412 << test_case.canonicalized_host << ", "
412 << test_case.lower_ascii_domain << ")"); 413 << test_case.lower_ascii_domain << ")");
413 414
414 EXPECT_EQ( 415 EXPECT_EQ(
415 test_case.expected_domain_is, 416 test_case.expected_domain_is,
416 DomainIs(test_case.canonicalized_host, test_case.lower_ascii_domain)); 417 DomainIs(test_case.canonicalized_host, test_case.lower_ascii_domain));
417 } 418 }
418 } 419 }
419 420
421 TEST(URLUtilTest, IsAboutBlank) {
422 const std::string kAboutBlankUrls[] = {"about:blank", "about:blank?foo",
423 "about:blank/#foo",
424 "about:blank?foo#foo"};
425 for (const auto& url : kAboutBlankUrls)
426 EXPECT_TRUE(IsAboutBlank(GURL(url)));
427
428 const std::string kNotAboutBlankUrls[] = {
429 "http:blank", "about:blan", "about://blank",
430 "about:blank/foo", "about://:8000/blank", "about://foo:foo@/blank",
431 "foo@about:blank", "foo:bar@about:blank", "about:blank:8000"};
432 for (const auto& url : kNotAboutBlankUrls)
433 EXPECT_FALSE(IsAboutBlank(GURL(url)));
434 }
435
420 } // namespace url 436 } // 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