| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 registerMockedURLLoad(kFileURL, WebString::fromUTF8("simple_test.mht")); | 187 registerMockedURLLoad(kFileURL, WebString::fromUTF8("simple_test.mht")); |
| 188 loadURLInTopFrame(url); | 188 loadURLInTopFrame(url); |
| 189 ASSERT_TRUE(page()); | 189 ASSERT_TRUE(page()); |
| 190 LocalFrame* frame = toLocalFrame(page()->mainFrame()); | 190 LocalFrame* frame = toLocalFrame(page()->mainFrame()); |
| 191 ASSERT_TRUE(frame); | 191 ASSERT_TRUE(frame); |
| 192 Document* document = frame->document(); | 192 Document* document = frame->document(); |
| 193 ASSERT_TRUE(document); | 193 ASSERT_TRUE(document); |
| 194 | 194 |
| 195 EXPECT_STREQ(kFileURL, frame->domWindow()->location()->href().ascii().data()
); | 195 EXPECT_STREQ(kFileURL, frame->domWindow()->location()->href().ascii().data()
); |
| 196 | 196 |
| 197 SecurityOrigin* origin = document->securityOrigin(); | 197 SecurityOrigin* origin = document->getSecurityOrigin(); |
| 198 EXPECT_STRNE("localhost", origin->domain().ascii().data()); | 198 EXPECT_STRNE("localhost", origin->domain().ascii().data()); |
| 199 } | 199 } |
| 200 | 200 |
| 201 TEST_F(MHTMLTest, TestMHTMLEncoding) | 201 TEST_F(MHTMLTest, TestMHTMLEncoding) |
| 202 { | 202 { |
| 203 addTestResources(); | 203 addTestResources(); |
| 204 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html", MH
TMLArchive::UseDefaultEncoding); | 204 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html", MH
TMLArchive::UseDefaultEncoding); |
| 205 | 205 |
| 206 // Read the MHTML data line per line and do some pseudo-parsing to make sure
the right encoding is used for the different sections. | 206 // Read the MHTML data line per line and do some pseudo-parsing to make sure
the right encoding is used for the different sections. |
| 207 LineReader lineReader(std::string(data->data(), data->size())); | 207 LineReader lineReader(std::string(data->data(), data->size())); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 // MHTMLArchives can be initialized from any local scheme, but never a remot
e scheme. | 244 // MHTMLArchives can be initialized from any local scheme, but never a remot
e scheme. |
| 245 EXPECT_EQ(nullptr, MHTMLArchive::create(httpURL, data.get())); | 245 EXPECT_EQ(nullptr, MHTMLArchive::create(httpURL, data.get())); |
| 246 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get())); | 246 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get())); |
| 247 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); | 247 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); |
| 248 SchemeRegistry::registerURLSchemeAsLocal("fooscheme"); | 248 SchemeRegistry::registerURLSchemeAsLocal("fooscheme"); |
| 249 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); | 249 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |