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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 const char url[] = "http://www.google.com/"; | 594 const char url[] = "http://www.google.com/"; |
595 WebCore::KURL src(WebCore::ParsedURLString, url); | 595 WebCore::KURL src(WebCore::ParsedURLString, url); |
596 EXPECT_TRUE(src.string() == url); // This really just initializes the cache. | 596 EXPECT_TRUE(src.string() == url); // This really just initializes the cache. |
597 WebCore::KURL dest = src.copy(); | 597 WebCore::KURL dest = src.copy(); |
598 EXPECT_TRUE(dest.string() == url); // This really just initializes the cache
. | 598 EXPECT_TRUE(dest.string() == url); // This really just initializes the cache
. |
599 | 599 |
600 // The pointers should be different for both UTF-8 and UTF-16. | 600 // The pointers should be different for both UTF-8 and UTF-16. |
601 EXPECT_NE(dest.string().impl(), src.string().impl()); | 601 EXPECT_NE(dest.string().impl(), src.string().impl()); |
602 } | 602 } |
603 | 603 |
| 604 TEST(KURLTest, DeepCopyInnerURL) |
| 605 { |
| 606 const char url[] = "filesystem:http://www.google.com/temporary/test.txt"; |
| 607 const char innerURL[] = "http://www.google.com/temporary"; |
| 608 WebCore::KURL src(WebCore::ParsedURLString, url); |
| 609 EXPECT_TRUE(src.string() == url); |
| 610 EXPECT_TRUE(src.innerURL()->string() == innerURL); |
| 611 WebCore::KURL dest = src.copy(); |
| 612 EXPECT_TRUE(dest.string() == url); |
| 613 EXPECT_TRUE(dest.innerURL()->string() == innerURL); |
| 614 } |
| 615 |
604 TEST(KURLTest, LastPathComponent) | 616 TEST(KURLTest, LastPathComponent) |
605 { | 617 { |
606 WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt")
; | 618 WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt")
; |
607 EXPECT_EQ("file.txt", url1.lastPathComponent()); | 619 EXPECT_EQ("file.txt", url1.lastPathComponent()); |
608 | 620 |
609 WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to
/file.txt"); | 621 WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to
/file.txt"); |
610 EXPECT_EQ(String(), invalidUTF8.lastPathComponent()); | 622 EXPECT_EQ(String(), invalidUTF8.lastPathComponent()); |
611 } | 623 } |
612 | 624 |
613 TEST(KURLTest, IsHierarchical) | 625 TEST(KURLTest, IsHierarchical) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 WebCore::KURL url2(WebCore::ParsedURLString, "foo-bar:"); | 658 WebCore::KURL url2(WebCore::ParsedURLString, "foo-bar:"); |
647 EXPECT_TRUE(url2.protocolIs("foo-bar")); | 659 EXPECT_TRUE(url2.protocolIs("foo-bar")); |
648 EXPECT_FALSE(url2.protocolIs("foo")); | 660 EXPECT_FALSE(url2.protocolIs("foo")); |
649 | 661 |
650 WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:"); | 662 WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:"); |
651 EXPECT_FALSE(invalidUTF8.protocolIs("http")); | 663 EXPECT_FALSE(invalidUTF8.protocolIs("http")); |
652 EXPECT_TRUE(invalidUTF8.protocolIs("")); | 664 EXPECT_TRUE(invalidUTF8.protocolIs("")); |
653 } | 665 } |
654 | 666 |
655 } // namespace | 667 } // namespace |
OLD | NEW |