OLD | NEW |
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 Loading... |
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 |
OLD | NEW |