Lines Matching refs:kurl
31 // Basic tests that verify our KURL's interface behaves the same as the
32 // original KURL's.
38 #include "KURL.h"
64 // Test the cases where we should be the same as WebKit's old KURL.
88 WebCore::KURL kurl(WebCore::ParsedURLString, cases[i].url);
90 EXPECT_EQ(cases[i].protocol, kurl.protocol());
91 EXPECT_EQ(cases[i].host, kurl.host());
92 EXPECT_EQ(cases[i].port, kurl.port());
93 EXPECT_EQ(cases[i].user, kurl.user());
94 EXPECT_EQ(cases[i].pass, kurl.pass());
95 EXPECT_EQ(cases[i].lastPathComponent, kurl.lastPathComponent());
96 EXPECT_EQ(cases[i].query, kurl.query());
97 EXPECT_EQ(cases[i].ref, kurl.fragmentIdentifier());
98 EXPECT_EQ(cases[i].hasRef, kurl.hasFragmentIdentifier());
102 kurl = WebCore::KURL(WebCore::ParsedURLString, utf16);
104 EXPECT_EQ(cases[i].protocol, kurl.protocol());
105 EXPECT_EQ(cases[i].host, kurl.host());
106 EXPECT_EQ(cases[i].port, kurl.port());
107 EXPECT_EQ(cases[i].user, kurl.user());
108 EXPECT_EQ(cases[i].pass, kurl.pass());
109 EXPECT_EQ(cases[i].lastPathComponent, kurl.lastPathComponent());
110 EXPECT_EQ(cases[i].query, kurl.query());
111 EXPECT_EQ(cases[i].ref, kurl.fragmentIdentifier());
112 EXPECT_EQ(cases[i].hasRef, kurl.hasFragmentIdentifier());
139 WebCore::KURL kurl(WebCore::ParsedURLString, cases[i].url);
141 EXPECT_EQ(cases[i].protocol, kurl.protocol());
142 EXPECT_EQ(cases[i].host, kurl.host());
143 EXPECT_EQ(cases[i].port, kurl.port());
144 EXPECT_EQ(cases[i].user, kurl.user());
145 EXPECT_EQ(cases[i].pass, kurl.pass());
146 EXPECT_EQ(cases[i].lastPath, kurl.lastPathComponent());
147 EXPECT_EQ(cases[i].query, kurl.query());
150 EXPECT_EQ(WTF::String::fromUTF8(cases[i].ref), kurl.fragmentIdentifier());
152 EXPECT_TRUE(kurl.fragmentIdentifier().isNull());
161 WebCore::KURL asciiKURL(WebCore::ParsedURLString, asciiURL);
172 WebCore::KURL mailto(WebCore::ParsedURLString, "mailto:foo@foo.com");
176 WebCore::KURL utf8KURL(WebCore::ParsedURLString, utf8URL);
184 // verify that we're always the same as the old KURL.
186 // Note that old KURL won't canonicalize the default port away, so we
237 WebCore::KURL kurl(WebCore::ParsedURLString, cases[i].url);
239 kurl.setProtocol(cases[i].protocol);
240 EXPECT_STREQ(cases[i].expectedProtocol, kurl.string().utf8().data());
242 kurl.setHost(cases[i].host);
243 EXPECT_STREQ(cases[i].expectedHost, kurl.string().utf8().data());
245 kurl.setPort(cases[i].port);
246 EXPECT_STREQ(cases[i].expectedPort, kurl.string().utf8().data());
248 kurl.setUser(cases[i].user);
249 EXPECT_STREQ(cases[i].expectedUser, kurl.string().utf8().data());
251 kurl.setPass(cases[i].pass);
252 EXPECT_STREQ(cases[i].expectedPass, kurl.string().utf8().data());
254 kurl.setPath(cases[i].path);
255 EXPECT_STREQ(cases[i].expectedPath, kurl.string().utf8().data());
257 kurl.setQuery(cases[i].query);
258 EXPECT_STREQ(cases[i].expectedQuery, kurl.string().utf8().data());
261 // KURL since we integrated a fix from their trunk.
265 // Tests that KURL::decodeURLEscapeSequences works as expected
330 WebCore::KURL emptyBase;
335 WebCore::KURL resolveAbs(emptyBase, abs);
341 WebCore::KURL resolveErr(emptyBase, rel);
345 // WebKit will make empty URLs and set components on them. kurl doesn't allow
349 WebCore::KURL kurl;
351 EXPECT_FALSE(kurl.isValid());
352 EXPECT_TRUE(kurl.isEmpty());
353 EXPECT_STREQ("", kurl.string().utf8().data());
355 kurl.setProtocol("http");
356 // GKURL will say that a URL with just a scheme is invalid, KURL will not.
358 EXPECT_FALSE(kurl.isValid());
360 EXPECT_TRUE(kurl.isValid());
362 EXPECT_FALSE(kurl.isEmpty());
367 EXPECT_STREQ("http:", kurl.string().utf8().data());
369 EXPECT_STREQ("http:/", kurl.string().utf8().data());
372 kurl.setHost("www.google.com");
373 EXPECT_TRUE(kurl.isValid());
374 EXPECT_FALSE(kurl.isEmpty());
375 EXPECT_STREQ("http://www.google.com/", kurl.string().utf8().data());
377 kurl.setPort(8000);
378 EXPECT_TRUE(kurl.isValid());
379 EXPECT_FALSE(kurl.isEmpty());
380 EXPECT_STREQ("http://www.google.com:8000/", kurl.string().utf8().data());
382 kurl.setPath("/favicon.ico");
383 EXPECT_TRUE(kurl.isValid());
384 EXPECT_FALSE(kurl.isEmpty());
385 EXPECT_STREQ("http://www.google.com:8000/favicon.ico", kurl.string().utf8().data());
390 EXPECT_FALSE(kurl.setProtocol("f/sj#@"));
391 EXPECT_TRUE(kurl.isValid());
398 WebCore::KURL kurl(WebCore::ParsedURLString, initial);
403 kurl.setPath(nullString);
404 EXPECT_STREQ("http://www.google.com/", kurl.string().utf8().data());
412 WebCore::KURL kurl(WebCore::ParsedURLString, initial);
417 kurl.setQuery(nullString);
418 EXPECT_STREQ("http://www.google.com/search", kurl.string().utf8().data());
421 kurl = WebCore::KURL(WebCore::ParsedURLString, initial);
424 kurl.setQuery(emptyString);
425 EXPECT_STREQ("http://www.google.com/search?", kurl.string().utf8().data());
429 kurl.setQuery(question);
431 kurl.string().utf8().data());
435 kurl.setQuery(query);
437 kurl.string().utf8().data());
442 WebCore::KURL kurl(WebCore::ParsedURLString, "http://foo/bar#baz");
445 WebCore::KURL cur(WebCore::ParsedURLString, "http://foo/bar");
448 cur = kurl;
453 cur = WebCore::KURL(WebCore::ParsedURLString, "http://foo/bar");
456 cur = kurl;
461 cur = WebCore::KURL(WebCore::ParsedURLString, "http://foo/bar");
464 cur = kurl;
471 WebCore::KURL kurl;
474 EXPECT_TRUE(kurl.isEmpty());
475 EXPECT_FALSE(kurl.isValid());
476 EXPECT_TRUE(kurl.isNull());
477 EXPECT_TRUE(kurl.string().isNull());
478 EXPECT_TRUE(kurl.string().isEmpty());
481 WebCore::KURL kurl2(kurl, "");
491 WebCore::KURL kurl22(kurl, WTF::String());
504 WebCore::KURL kurl3(WebCore::KURL(WebCore::ParsedURLString, "data:foo"),
512 WebCore::KURL kurl4(WebCore::ParsedURLString, kurl.string());
519 WebCore::KURL kurl5(WebCore::KURL(), "foo.js");
520 // We'll be empty in this case, but KURL won't be. Should be OK.
527 WebCore::KURL kurl6(WebCore::ParsedURLString, "");
534 WebCore::KURL kurl7(WebCore::ParsedURLString, "foo.js");
545 WebCore::KURL kurl(WebCore::ParsedURLString, src);
548 kurl.setUser("");
549 EXPECT_EQ("http://:pass@google.com/", kurl.string());
552 kurl = WebCore::KURL(WebCore::ParsedURLString, src);
553 kurl.setPass("");
554 EXPECT_EQ("http://user@google.com/", kurl.string());
557 kurl.setUser("");
558 EXPECT_EQ("http://google.com/", kurl.string());
564 WebCore::KURL kurl1(WebCore::ParsedURLString, src1);
573 WebCore::KURL kurl2(WebCore::ParsedURLString, src2);
582 WebCore::KURL kurl3(WebCore::ParsedURLString, src3);
594 WebCore::KURL src(WebCore::ParsedURLString, url);
596 WebCore::KURL dest = src.copy();
606 WebCore::KURL url1(WebCore::ParsedURLString, "foo://bar");
610 WebCore::KURL url2(WebCore::ParsedURLString, "foo-bar:");