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

Side by Side Diff: webkit/tools/webcore_unit_tests/GKURL_unittest.cpp

Issue 28320: Fix unittest to match new querystring parsing rules.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « DEPS ('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 (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 const char* protocol; 76 const char* protocol;
77 const char* host; 77 const char* host;
78 int port; 78 int port;
79 const char* user; 79 const char* user;
80 const char* pass; 80 const char* pass;
81 const char* last_path_component; 81 const char* last_path_component;
82 const char* query; 82 const char* query;
83 const char* ref; 83 const char* ref;
84 bool has_ref; 84 bool has_ref;
85 } cases[] = { 85 } cases[] = {
86 {"http://www.google.com/foo/blah?bar=baz#ref", "http", "www.google.com", 0, "", NULL, "blah", "?bar=baz", "ref", true}, 86 {"http://www.google.com/foo/blah?bar=baz#ref", "http", "www.google.com", 0, "", NULL, "blah", "bar=baz", "ref", true},
87 {"http://foo.com:1234/foo/bar/", "http", "foo.com", 1234, "", NULL, "bar", " ", NULL, false}, 87 {"http://foo.com:1234/foo/bar/", "http", "foo.com", 1234, "", NULL, "bar", " ", NULL, false},
88 {"http://www.google.com?#", "http", "www.google.com", 0, "", NULL, NULL, "?" , "", true}, 88 {"http://www.google.com?#", "http", "www.google.com", 0, "", NULL, NULL, "", "", true},
89 {"https://me:pass@google.com:23#foo", "https", "google.com", 23, "me", "pass ", NULL, "", "foo", true}, 89 {"https://me:pass@google.com:23#foo", "https", "google.com", 23, "me", "pass ", NULL, "", "foo", true},
90 {"javascript:hello!//world", "javascript", "", 0, "", NULL, "world", "", NUL L, false}, 90 {"javascript:hello!//world", "javascript", "", 0, "", NULL, "world", "", NUL L, false},
91 }; 91 };
92 92
93 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { 93 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
94 // UTF-8 94 // UTF-8
95 WebCore::KURL gurl(cases[i].url); 95 WebCore::KURL gurl(cases[i].url);
96 96
97 EXPECT_EQ(cases[i].protocol, gurl.protocol()); 97 EXPECT_EQ(cases[i].protocol, gurl.protocol());
98 EXPECT_EQ(cases[i].host, gurl.host()); 98 EXPECT_EQ(cases[i].host, gurl.host());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 {"javascript:hello!?#/\\world", "javascript", "", 0, "" , NULL, "hello!?#/\\world", "world", "", NULL}, 134 {"javascript:hello!?#/\\world", "javascript", "", 0, "" , NULL, "hello!?#/\\world", "world", "", NULL},
135 135
136 // Old WebKit doesn't handle "parameters" in paths, so will 136 // Old WebKit doesn't handle "parameters" in paths, so will
137 // disagree with us about where the path is for this URL. 137 // disagree with us about where the path is for this URL.
138 {"http://a.com/hello;world", "http", "a.com", 0, "" , NULL, "/hello;world", "hello", "", NULL}, 138 {"http://a.com/hello;world", "http", "a.com", 0, "" , NULL, "/hello;world", "hello", "", NULL},
139 139
140 // WebKit doesn't like UTF-8 or UTF-16 input. 140 // WebKit doesn't like UTF-8 or UTF-16 input.
141 {"http://\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xbd\xa0\xe5\xa5\xbd/", "http", "xn--6q qa088eba", 0, "", NULL, "/", NULL, "", NULL}, 141 {"http://\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xbd\xa0\xe5\xa5\xbd/", "http", "xn--6q qa088eba", 0, "", NULL, "/", NULL, "", NULL},
142 142
143 // WebKit %-escapes non-ASCII characters in reference, but we don't. 143 // WebKit %-escapes non-ASCII characters in reference, but we don't.
144 {"http://www.google.com/foo/blah?bar=baz#\xce\xb1\xce\xb2", "http", "www.goo gle.com", 0, "", NULL, "/foo/blah/", "blah", "?bar=baz", "\xce\xb1\xce\xb2"} 144 {"http://www.google.com/foo/blah?bar=baz#\xce\xb1\xce\xb2", "http", "www.goo gle.com", 0, "", NULL, "/foo/blah/", "blah", "bar=baz", "\xce\xb1\xce\xb2"}
145 }; 145 };
146 146
147 for (size_t i = 0; i < arraysize(cases); i++) { 147 for (size_t i = 0; i < arraysize(cases); i++) {
148 WebCore::KURL gurl(cases[i].url); 148 WebCore::KURL gurl(cases[i].url);
149 149
150 EXPECT_EQ(cases[i].protocol, gurl.protocol()); 150 EXPECT_EQ(cases[i].protocol, gurl.protocol());
151 EXPECT_EQ(cases[i].host, gurl.host()); 151 EXPECT_EQ(cases[i].host, gurl.host());
152 EXPECT_EQ(cases[i].port, gurl.port()); 152 EXPECT_EQ(cases[i].port, gurl.port());
153 EXPECT_EQ(cases[i].user, gurl.user()); 153 EXPECT_EQ(cases[i].user, gurl.user());
154 EXPECT_EQ(cases[i].pass, gurl.pass()); 154 EXPECT_EQ(cases[i].pass, gurl.pass());
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 const char url[] = "http://www.google.com/"; 591 const char url[] = "http://www.google.com/";
592 WebCore::KURL src(url); 592 WebCore::KURL src(url);
593 EXPECT_TRUE(src.string() == url); // This really just initializes the cache. 593 EXPECT_TRUE(src.string() == url); // This really just initializes the cache.
594 WebCore::KURL dest = src.copy(); 594 WebCore::KURL dest = src.copy();
595 EXPECT_TRUE(dest.string() == url); // This really just initializes the cache. 595 EXPECT_TRUE(dest.string() == url); // This really just initializes the cache.
596 596
597 // The pointers should be different for both UTF-8 and UTF-16. 597 // The pointers should be different for both UTF-8 and UTF-16.
598 EXPECT_NE(dest.string().characters(), src.string().characters()); 598 EXPECT_NE(dest.string().characters(), src.string().characters());
599 EXPECT_NE(dest.utf8String().data(), src.utf8String().data()); 599 EXPECT_NE(dest.utf8String().data(), src.utf8String().data());
600 } 600 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698