Example #1
0
// Checks that the domain is set to the actual MHTML file, not the URL it was
// generated from.
TEST_F(MHTMLTest, CheckDomain)
{
    const char kFileURL[] = "file:///simple_test.mht";

    // Register the mocked frame and load it.
    WebURL url = toKURL(kFileURL);
    registerMockedURLLoad(kFileURL, WebString::fromUTF8("simple_test.mht"));
    loadURLInTopFrame(url);
    ASSERT_TRUE(page());
    LocalFrame* frame = toLocalFrame(page()->mainFrame());
    ASSERT_TRUE(frame);
    Document* document = frame->document();
    ASSERT_TRUE(document);

    EXPECT_STREQ(kFileURL, frame->domWindow()->location()->href().ascii().data());

    SecurityOrigin* origin = document->securityOrigin();
    EXPECT_STRNE("localhost", origin->domain().ascii().data());
}