| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // get the correct string object out. | 148 // get the correct string object out. |
| 149 TEST(KURLTest, DISABLED_UTF8) | 149 TEST(KURLTest, DISABLED_UTF8) |
| 150 { | 150 { |
| 151 const char asciiURL[] = "http://foo/bar#baz"; | 151 const char asciiURL[] = "http://foo/bar#baz"; |
| 152 KURL asciiKURL(ParsedURLString, asciiURL); | 152 KURL asciiKURL(ParsedURLString, asciiURL); |
| 153 EXPECT_TRUE(asciiKURL.getString() == String(asciiURL)); | 153 EXPECT_TRUE(asciiKURL.getString() == String(asciiURL)); |
| 154 | 154 |
| 155 // When the result is ASCII, we should get an ASCII String. Some | 155 // When the result is ASCII, we should get an ASCII String. Some |
| 156 // code depends on being able to compare the result of the .string() | 156 // code depends on being able to compare the result of the .string() |
| 157 // getter with another String, and the isASCIIness of the two | 157 // getter with another String, and the isASCIIness of the two |
| 158 // strings must match for these functions (like equalIgnoringCase). | 158 // strings must match for these functions (like equalIgnoringASCIICase). |
| 159 EXPECT_TRUE(equalIgnoringCase(asciiKURL, String(asciiURL))); | 159 EXPECT_TRUE(equalIgnoringASCIICase(asciiKURL, String(asciiURL))); |
| 160 | 160 |
| 161 // Reproduce code path in FrameLoader.cpp -- equalIgnoringCase implicitly | 161 // Reproduce code path in FrameLoader.cpp -- equalIgnoringASCIICase implicit
ly |
| 162 // expects gkurl.protocol() to have been created as ascii. | 162 // expects gkurl.protocol() to have been created as ascii. |
| 163 KURL mailto(ParsedURLString, "mailto:foo@foo.com"); | 163 KURL mailto(ParsedURLString, "mailto:foo@foo.com"); |
| 164 EXPECT_TRUE(equalIgnoringCase(mailto.protocol(), "mailto")); | 164 EXPECT_TRUE(equalIgnoringASCIICase(mailto.protocol(), "mailto")); |
| 165 | 165 |
| 166 const char utf8URL[] = "http://foo/bar#\xe4\xbd\xa0\xe5\xa5\xbd"; | 166 const char utf8URL[] = "http://foo/bar#\xe4\xbd\xa0\xe5\xa5\xbd"; |
| 167 KURL utf8KURL(ParsedURLString, utf8URL); | 167 KURL utf8KURL(ParsedURLString, utf8URL); |
| 168 | 168 |
| 169 EXPECT_TRUE(utf8KURL.getString() == String::fromUTF8(utf8URL)); | 169 EXPECT_TRUE(utf8KURL.getString() == String::fromUTF8(utf8URL)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 TEST(KURLTest, Setters) | 172 TEST(KURLTest, Setters) |
| 173 { | 173 { |
| 174 // Replace the starting URL with the given components one at a time and | 174 // Replace the starting URL with the given components one at a time and |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 }; | 762 }; |
| 763 | 763 |
| 764 for (size_t i = 0; i < WTF_ARRAY_LENGTH(referrerCases); i++) { | 764 for (size_t i = 0; i < WTF_ARRAY_LENGTH(referrerCases); i++) { |
| 765 KURL kurl(ParsedURLString, referrerCases[i].input); | 765 KURL kurl(ParsedURLString, referrerCases[i].input); |
| 766 String referrer = kurl.strippedForUseAsReferrer(); | 766 String referrer = kurl.strippedForUseAsReferrer(); |
| 767 EXPECT_STREQ(referrerCases[i].output, referrer.utf8().data()); | 767 EXPECT_STREQ(referrerCases[i].output, referrer.utf8().data()); |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace blink | 771 } // namespace blink |
| OLD | NEW |