| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/SerializedResource.h" | 35 #include "platform/SerializedResource.h" |
| 36 #include "platform/SharedBuffer.h" | 36 #include "platform/SharedBuffer.h" |
| 37 #include "platform/mhtml/MHTMLArchive.h" | 37 #include "platform/mhtml/MHTMLArchive.h" |
| 38 #include "platform/testing/URLTestHelpers.h" | 38 #include "platform/testing/URLTestHelpers.h" |
| 39 #include "platform/testing/UnitTestHelpers.h" | 39 #include "platform/testing/UnitTestHelpers.h" |
| 40 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 41 #include "platform/weborigin/SchemeRegistry.h" | 41 #include "platform/weborigin/SchemeRegistry.h" |
| 42 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 43 #include "public/platform/WebString.h" | 43 #include "public/platform/WebString.h" |
| 44 #include "public/platform/WebURL.h" | 44 #include "public/platform/WebURL.h" |
| 45 #include "public/platform/WebURLLoaderMockFactory.h" |
| 45 #include "public/platform/WebURLRequest.h" | 46 #include "public/platform/WebURLRequest.h" |
| 46 #include "public/platform/WebURLResponse.h" | 47 #include "public/platform/WebURLResponse.h" |
| 47 #include "public/platform/WebUnitTestSupport.h" | 48 #include "public/web/WebCache.h" |
| 48 #include "public/web/WebDocument.h" | 49 #include "public/web/WebDocument.h" |
| 49 #include "public/web/WebFrame.h" | 50 #include "public/web/WebFrame.h" |
| 50 #include "public/web/WebView.h" | 51 #include "public/web/WebView.h" |
| 51 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
| 52 #include "web/tests/FrameTestHelpers.h" | 53 #include "web/tests/FrameTestHelpers.h" |
| 53 | 54 |
| 54 using blink::URLTestHelpers::toKURL; | 55 using blink::URLTestHelpers::toKURL; |
| 55 | 56 |
| 56 namespace blink { | 57 namespace blink { |
| 57 | 58 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 91 } |
| 91 | 92 |
| 92 protected: | 93 protected: |
| 93 void SetUp() override | 94 void SetUp() override |
| 94 { | 95 { |
| 95 m_helper.initialize(); | 96 m_helper.initialize(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 void TearDown() override | 99 void TearDown() override |
| 99 { | 100 { |
| 100 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 101 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 102 WebCache::clear(); |
| 101 } | 103 } |
| 102 | 104 |
| 103 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) | 105 void registerMockedURLLoad(const std::string& url, const WebString& fileName
) |
| 104 { | 106 { |
| 105 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("mhtml/"), WebString::fromUTF8("text/html")); | 107 URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::
fromUTF8("mhtml/"), WebString::fromUTF8("text/html")); |
| 106 } | 108 } |
| 107 | 109 |
| 108 void loadURLInTopFrame(const WebURL& url) | 110 void loadURLInTopFrame(const WebURL& url) |
| 109 { | 111 { |
| 110 FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), url.string(
).utf8().data()); | 112 FrameTestHelpers::loadFrame(m_helper.webView()->mainFrame(), url.string(
).utf8().data()); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 245 |
| 244 // MHTMLArchives can be initialized from any local scheme, but never a remot
e scheme. | 246 // MHTMLArchives can be initialized from any local scheme, but never a remot
e scheme. |
| 245 EXPECT_EQ(nullptr, MHTMLArchive::create(httpURL, data.get())); | 247 EXPECT_EQ(nullptr, MHTMLArchive::create(httpURL, data.get())); |
| 246 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get())); | 248 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get())); |
| 247 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); | 249 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); |
| 248 SchemeRegistry::registerURLSchemeAsLocal("fooscheme"); | 250 SchemeRegistry::registerURLSchemeAsLocal("fooscheme"); |
| 249 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); | 251 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); |
| 250 } | 252 } |
| 251 | 253 |
| 252 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |