Lines Matching refs:kurl
31 // Basic tests that verify our KURL's interface behaves the same as the
32 // original KURL's.
35 #include "platform/weborigin/KURL.h"
56 // Test the cases where we should be the same as WebKit's old KURL.
80 blink::KURL kurl(blink::ParsedURLString, cases[i].url);
82 EXPECT_EQ(cases[i].protocol, kurl.protocol());
83 EXPECT_EQ(cases[i].host, kurl.host());
84 EXPECT_EQ(cases[i].port, kurl.port());
85 EXPECT_EQ(cases[i].user, kurl.user());
86 EXPECT_EQ(cases[i].pass, kurl.pass());
87 EXPECT_EQ(cases[i].lastPathComponent, kurl.lastPathComponent());
88 EXPECT_EQ(cases[i].query, kurl.query());
89 EXPECT_EQ(cases[i].ref, kurl.fragmentIdentifier());
90 EXPECT_EQ(cases[i].hasRef, kurl.hasFragmentIdentifier());
94 kurl = blink::KURL(blink::ParsedURLString, utf16);
96 EXPECT_EQ(cases[i].protocol, kurl.protocol());
97 EXPECT_EQ(cases[i].host, kurl.host());
98 EXPECT_EQ(cases[i].port, kurl.port());
99 EXPECT_EQ(cases[i].user, kurl.user());
100 EXPECT_EQ(cases[i].pass, kurl.pass());
101 EXPECT_EQ(cases[i].lastPathComponent, kurl.lastPathComponent());
102 EXPECT_EQ(cases[i].query, kurl.query());
103 EXPECT_EQ(cases[i].ref, kurl.fragmentIdentifier());
104 EXPECT_EQ(cases[i].hasRef, kurl.hasFragmentIdentifier());
131 blink::KURL kurl(blink::ParsedURLString, cases[i].url);
133 EXPECT_EQ(cases[i].protocol, kurl.protocol());
134 EXPECT_EQ(cases[i].host, kurl.host());
135 EXPECT_EQ(cases[i].port, kurl.port());
136 EXPECT_EQ(cases[i].user, kurl.user());
137 EXPECT_EQ(cases[i].pass, kurl.pass());
138 EXPECT_EQ(cases[i].lastPath, kurl.lastPathComponent());
139 EXPECT_EQ(cases[i].query, kurl.query());
142 EXPECT_EQ(WTF::String::fromUTF8(cases[i].ref), kurl.fragmentIdentifier());
144 EXPECT_TRUE(kurl.fragmentIdentifier().isNull());
153 blink::KURL asciiKURL(blink::ParsedURLString, asciiURL);
164 blink::KURL mailto(blink::ParsedURLString, "mailto:foo@foo.com");
168 blink::KURL utf8KURL(blink::ParsedURLString, utf8URL);
176 // verify that we're always the same as the old KURL.
178 // Note that old KURL won't canonicalize the default port away, so we
242 blink::KURL kurl(blink::ParsedURLString, cases[i].url);
244 kurl.setProtocol(cases[i].protocol);
245 EXPECT_STREQ(cases[i].expectedProtocol, kurl.string().utf8().data());
247 kurl.setHost(cases[i].host);
248 EXPECT_STREQ(cases[i].expectedHost, kurl.string().utf8().data());
250 kurl.setPort(cases[i].port);
251 EXPECT_STREQ(cases[i].expectedPort, kurl.string().utf8().data());
253 kurl.setUser(cases[i].user);
254 EXPECT_STREQ(cases[i].expectedUser, kurl.string().utf8().data());
256 kurl.setPass(cases[i].pass);
257 EXPECT_STREQ(cases[i].expectedPass, kurl.string().utf8().data());
259 kurl.setPath(cases[i].path);
260 EXPECT_STREQ(cases[i].expectedPath, kurl.string().utf8().data());
262 kurl.setQuery(cases[i].query);
263 EXPECT_STREQ(cases[i].expectedQuery, kurl.string().utf8().data());
266 // KURL since we integrated a fix from their trunk.
270 // Tests that KURL::decodeURLEscapeSequences works as expected
360 blink::KURL emptyBase;
365 blink::KURL resolveAbs(emptyBase, abs);
371 blink::KURL resolveErr(emptyBase, rel);
375 // WebKit will make empty URLs and set components on them. kurl doesn't allow
379 blink::KURL kurl;
381 EXPECT_FALSE(kurl.isValid());
382 EXPECT_TRUE(kurl.isEmpty());
383 EXPECT_STREQ("", kurl.string().utf8().data());
385 kurl.setProtocol("http");
386 // GKURL will say that a URL with just a scheme is invalid, KURL will not.
387 EXPECT_FALSE(kurl.isValid());
388 EXPECT_FALSE(kurl.isEmpty());
392 EXPECT_STREQ("http:", kurl.string().utf8().data());
394 kurl.setHost("www.google.com");
395 EXPECT_TRUE(kurl.isValid());
396 EXPECT_FALSE(kurl.isEmpty());
397 EXPECT_STREQ("http://www.google.com/", kurl.string().utf8().data());
399 kurl.setPort(8000);
400 EXPECT_TRUE(kurl.isValid());
401 EXPECT_FALSE(kurl.isEmpty());
402 EXPECT_STREQ("http://www.google.com:8000/", kurl.string().utf8().data());
404 kurl.setPath("/favicon.ico");
405 EXPECT_TRUE(kurl.isValid());
406 EXPECT_FALSE(kurl.isEmpty());
407 EXPECT_STREQ("http://www.google.com:8000/favicon.ico", kurl.string().utf8().data());
411 EXPECT_FALSE(kurl.setProtocol("f/sj#@"));
412 EXPECT_TRUE(kurl.isValid());
418 blink::KURL kurl(blink::ParsedURLString, initial);
423 kurl.setPath(nullString);
424 EXPECT_STREQ("http://www.google.com/", kurl.string().utf8().data());
432 blink::KURL kurl(blink::ParsedURLString, initial);
437 kurl.setQuery(nullString);
438 EXPECT_STREQ("http://www.google.com/search", kurl.string().utf8().data());
441 kurl = blink::KURL(blink::ParsedURLString, initial);
444 kurl.setQuery(emptyString);
445 EXPECT_STREQ("http://www.google.com/search?", kurl.string().utf8().data());
449 kurl.setQuery(question);
451 kurl.string().utf8().data());
455 kurl.setQuery(query);
457 kurl.string().utf8().data());
462 blink::KURL kurl(blink::ParsedURLString, "http://foo/bar#baz");
465 blink::KURL cur(blink::ParsedURLString, "http://foo/bar");
468 cur = kurl;
473 cur = blink::KURL(blink::ParsedURLString, "http://foo/bar");
476 cur = kurl;
481 cur = blink::KURL(blink::ParsedURLString, "http://foo/bar");
484 cur = kurl;
491 blink::KURL kurl;
494 EXPECT_TRUE(kurl.isEmpty());
495 EXPECT_FALSE(kurl.isValid());
496 EXPECT_TRUE(kurl.isNull());
497 EXPECT_TRUE(kurl.string().isNull());
498 EXPECT_TRUE(kurl.string().isEmpty());
501 blink::KURL kurl2(kurl, "");
511 blink::KURL kurl22(kurl, WTF::String());
523 blink::KURL kurl3(blink::KURL(blink::ParsedURLString, "data:foo"),
530 blink::KURL kurl4(blink::ParsedURLString, kurl.string());
537 blink::KURL kurl5(blink::KURL(), "foo.js");
538 // We'll be empty in this case, but KURL won't be. Should be OK.
545 blink::KURL kurl6(blink::ParsedURLString, "");
552 blink::KURL kurl7(blink::ParsedURLString, "foo.js");
563 blink::KURL kurl(blink::ParsedURLString, src);
566 kurl.setUser("");
567 EXPECT_EQ("http://:pass@google.com/", kurl.string());
570 kurl = blink::KURL(blink::ParsedURLString, src);
571 kurl.setPass("");
572 EXPECT_EQ("http://user@google.com/", kurl.string());
575 kurl.setUser("");
576 EXPECT_EQ("http://google.com/", kurl.string());
582 blink::KURL kurl1(blink::ParsedURLString, src1);
591 blink::KURL kurl2(blink::ParsedURLString, src2);
600 blink::KURL kurl3(blink::ParsedURLString, src3);
612 blink::KURL src(blink::ParsedURLString, url);
614 blink::KURL dest = src.copy();
625 blink::KURL src(blink::ParsedURLString, url);
628 blink::KURL dest = src.copy();
635 blink::KURL url1(blink::ParsedURLString, "http://host/path/to/file.txt");
638 blink::KURL invalidUTF8(blink::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
644 blink::KURL url1(blink::ParsedURLString, "http://host/path/to/file.txt");
647 blink::KURL invalidUTF8(blink::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
653 blink::KURL url1(blink::ParsedURLString, "http://host/path/to/file.txt");
656 blink::KURL invalidUTF8(blink::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
662 blink::KURL url1(blink::ParsedURLString, "http://host/path/to/file.txt");
665 blink::KURL invalidUTF8(blink::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
671 blink::KURL url1(blink::ParsedURLString, "foo://bar");
675 blink::KURL url2(blink::ParsedURLString, "foo-bar:");
679 blink::KURL invalidUTF8(blink::ParsedURLString, "http://a@9%aa%:");
701 blink::KURL kurl(blink::ParsedURLString, referrerCases[i].input);
702 WTF::String referrer = kurl.strippedForUseAsReferrer();