Source/core/dom/DocumentTest.cpp
// This test checks that Documunt::linkManifest() returns a value conform to the specification.
This test checks that Documunt::linkManifest() returns a value conform to the specification.
This test checks that Documunt :: linkManifest () returns a value conform to the specification .
TEST_F(DocumentTest, LinkManifest)
{
    EXPECT_EQ(0, document().linkManifest());
    RefPtrWillBeRawPtr<HTMLLinkElement> link = HTMLLinkElement::create(document(), false);
    link->setAttribute(WebCore::HTMLNames::relAttr, "manifest");
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "foo.json");
    document().head()->appendChild(link);
    EXPECT_EQ(link, document().linkManifest());
    RefPtrWillBeRawPtr<HTMLLinkElement> link2 = HTMLLinkElement::create(document(), false);
    link2->setAttribute(WebCore::HTMLNames::relAttr, "manifest");
    link2->setAttribute(WebCore::HTMLNames::hrefAttr, "bar.json");
    document().head()->insertBefore(link2, link.get());
    EXPECT_EQ(link2, document().linkManifest());
    document().head()->appendChild(link2);
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "http:foo.json");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "http://example.org/manifest.json");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "http://foo.example.org/manifest.json");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hrefAttr, "http://foo.bar/manifest.json");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::relAttr, "foo bar manifest");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::relAttr, " manifest ");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::relAttr, "");
    EXPECT_EQ(link2, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::relAttr, "manifest");
    document().head()->removeChild(link.get(), ASSERT_NO_EXCEPTION);
    document().head()->removeChild(link2.get(), ASSERT_NO_EXCEPTION);
    EXPECT_EQ(0, document().linkManifest());
    document().body()->appendChild(link);
    EXPECT_EQ(0, document().linkManifest());
    document().head()->appendChild(link);
    document().head()->appendChild(link2);
    link->setAttribute(WebCore::HTMLNames::crossoriginAttr, "use-credentials");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::hreflangAttr, "klingon");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::typeAttr, "image/gif");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::sizesAttr, "16x16");
    EXPECT_EQ(link, document().linkManifest());
    link->setAttribute(WebCore::HTMLNames::mediaAttr, "print");
    EXPECT_EQ(link, document().linkManifest());
}
TEST_F ( DocumentTest , LinkManifest ) { EXPECT_EQ ( 0 , document ( ) . linkManifest ( ) ) ; RefPtrWillBeRawPtr < HTMLLinkElement > link = HTMLLinkElement :: create ( document ( ) , false ) ; link -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; document ( ) . head ( ) -> appendChild ( link ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; RefPtrWillBeRawPtr < HTMLLinkElement > link2 = HTMLLinkElement :: create ( document ( ) , false ) ; link2 -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; link2 -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; document ( ) . head ( ) -> insertBefore ( link2 , link . get ( ) ) ; EXPECT_EQ ( link2 , document ( ) . linkManifest ( ) ) ; document ( ) . head ( ) -> appendChild ( link2 ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hrefAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; EXPECT_EQ ( link2 , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: relAttr , " " ) ; document ( ) . head ( ) -> removeChild ( link . get ( ) , ASSERT_NO_EXCEPTION ) ; document ( ) . head ( ) -> removeChild ( link2 . get ( ) , ASSERT_NO_EXCEPTION ) ; EXPECT_EQ ( 0 , document ( ) . linkManifest ( ) ) ; document ( ) . body ( ) -> appendChild ( link ) ; EXPECT_EQ ( 0 , document ( ) . linkManifest ( ) ) ; document ( ) . head ( ) -> appendChild ( link ) ; document ( ) . head ( ) -> appendChild ( link2 ) ; link -> setAttribute ( WebCore :: HTMLNames :: crossoriginAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: hreflangAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: typeAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: sizesAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; link -> setAttribute ( WebCore :: HTMLNames :: mediaAttr , " " ) ; EXPECT_EQ ( link , document ( ) . linkManifest ( ) ) ; }
This test checks that Documunt::linkManifest() returns a value conform to the specification.
This test checks that Documunt :: linkManifest () returns a value conform to the specification .
// Test the default result. // Check that we use the first manifest with <link rel=manifest> // Check that crazy URLs are accepted. // Check that empty URLs are accepted. // Check that URLs from different origins are accepted. // More than one token in @rel is accepted. // Such as spaces around the token. // Check that rel=manifest actually matters. // Check that link outside of the <head> are ignored. // Check that some attribute values do not have an effect.