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

Side by Side Diff: Source/platform/weborigin/KURLTest.cpp

Issue 610493002: adjust blink::equalIgnoringFragmentIdentifier to work better for data: (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add test Created 6 years, 2 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
« no previous file with comments | « Source/platform/weborigin/KURL.cpp ('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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 {"https://www.google.com/a?f#b", "https://www.google.com/a?f"}, 697 {"https://www.google.com/a?f#b", "https://www.google.com/a?f"},
698 }; 698 };
699 699
700 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(referrerCases); i++) { 700 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(referrerCases); i++) {
701 blink::KURL kurl(blink::ParsedURLString, referrerCases[i].input); 701 blink::KURL kurl(blink::ParsedURLString, referrerCases[i].input);
702 WTF::String referrer = kurl.strippedForUseAsReferrer(); 702 WTF::String referrer = kurl.strippedForUseAsReferrer();
703 EXPECT_STREQ(referrerCases[i].output, referrer.utf8().data()); 703 EXPECT_STREQ(referrerCases[i].output, referrer.utf8().data());
704 } 704 }
705 } 705 }
706 706
707 TEST(KURLTest, EqualIgnoringFragmentIdentifier)
708 {
709 struct FragmentIdentifierCase {
710 const char* urlA;
711 const char* urlB;
712
713 bool equal;
714 } cases[] = {
715 {
716 "http://www.example.com/foo#bar",
717 "http://www.example.com/foo#baz",
718 true,
719 }, {
720 "http://www.example.com/foo#bar",
721 "https://www.example.com/foo#baz",
722 false,
723 }, {
724 "data:text/html;charset=utf-8,<!-- http://www.example.com/demo#a --> foo",
725 "data:text/html;charset=utf-8,<!-- http://www.example.com/demo#a --> bar",
726 false,
727 }, {
728 "data:text/html;charset=utf-8,bag",
729 "data:text/html;charset=utf-8,bag",
730 true,
731 },
732 };
733
734 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
735 blink::KURL kurlA(blink::ParsedURLString, cases[i].urlA);
736 blink::KURL kurlB(blink::ParsedURLString, cases[i].urlB);
737 EXPECT_EQ(cases[i].equal, blink::equalIgnoringFragmentIdentifier(kurlA, kurlB));
738 }
739 }
740
707 } // namespace 741 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/weborigin/KURL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698