| Index: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
|
| index 54b44ad9895716dcb63022d5ff8732ee758197da..d35fbee9bf198b8d45b824fd2b8009993011bd50 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
|
| @@ -68,6 +68,7 @@
|
| #include "web/tests/FakeWebPlugin.h"
|
| #include "web/tests/FrameTestHelpers.h"
|
| #include <memory>
|
| +#include <string>
|
|
|
| using blink::testing::runPendingTasks;
|
|
|
| @@ -91,6 +92,14 @@ class WebPluginContainerTest : public ::testing::Test {
|
| cutOutRects);
|
| }
|
|
|
| + void registerMockedURL(
|
| + const std::string& fileName,
|
| + const std::string& mimeType = std::string("text/html")) {
|
| + URLTestHelpers::registerMockedURLLoadFromBase(
|
| + WebString::fromUTF8(m_baseURL), testing::webTestDataPath(),
|
| + WebString::fromUTF8(fileName), WebString::fromUTF8(mimeType));
|
| + }
|
| +
|
| protected:
|
| std::string m_baseURL;
|
| };
|
| @@ -161,9 +170,7 @@ WebPluginContainer* getWebPluginContainer(WebView* webView,
|
| } // namespace
|
|
|
| TEST_F(WebPluginContainerTest, WindowToLocalPointTest) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -198,9 +205,7 @@ TEST_F(WebPluginContainerTest, WindowToLocalPointTest) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"),
|
| - WebString::fromUTF8("application/pdf"));
|
| + registerMockedURL("test.pdf", "application/pdf");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -217,12 +222,8 @@ TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, IFramePluginDocumentNotFocused) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"),
|
| - WebString::fromUTF8("application/pdf"));
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("iframe_pdf.html"), WebString::fromUTF8("text/html"));
|
| + registerMockedURL("test.pdf", "application/pdf");
|
| + registerMockedURL("iframe_pdf.html", "text/html");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -241,9 +242,7 @@ TEST_F(WebPluginContainerTest, IFramePluginDocumentNotFocused) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, PrintOnePage) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"),
|
| - WebString::fromUTF8("application/pdf"));
|
| + registerMockedURL("test.pdf", "application/pdf");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -266,9 +265,7 @@ TEST_F(WebPluginContainerTest, PrintOnePage) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, PrintAllPages) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"),
|
| - WebString::fromUTF8("application/pdf"));
|
| + registerMockedURL("test.pdf", "application/pdf");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -292,9 +289,7 @@ TEST_F(WebPluginContainerTest, PrintAllPages) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, LocalToWindowPointTest) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -328,9 +323,7 @@ TEST_F(WebPluginContainerTest, LocalToWindowPointTest) {
|
|
|
| // Verifies executing the command 'Copy' results in copying to the clipboard.
|
| TEST_F(WebPluginContainerTest, Copy) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -353,9 +346,7 @@ TEST_F(WebPluginContainerTest, Copy) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, CopyFromContextMenu) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -397,9 +388,7 @@ TEST_F(WebPluginContainerTest, CopyFromContextMenu) {
|
| // Verifies |Ctrl-C| and |Ctrl-Insert| keyboard events, results in copying to
|
| // the clipboard.
|
| TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -476,9 +465,7 @@ class EventTestPlugin : public FakeWebPlugin {
|
| };
|
|
|
| TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| CustomPluginWebFrameClient<EventTestPlugin>
|
| pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -527,9 +514,7 @@ TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| CustomPluginWebFrameClient<EventTestPlugin>
|
| pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -567,9 +552,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) {
|
|
|
| // Verify that isRectTopmost returns false when the document is detached.
|
| TEST_F(WebPluginContainerTest, IsRectTopmostTest) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(
|
| @@ -603,12 +586,8 @@ TEST_F(WebPluginContainerTest, IsRectTopmostTest) {
|
| } while (false)
|
|
|
| TEST_F(WebPluginContainerTest, ClippedRectsForIframedElement) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_containing_page.html"));
|
| + registerMockedURL("plugin_container.html");
|
| + registerMockedURL("plugin_containing_page.html");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -641,9 +620,7 @@ TEST_F(WebPluginContainerTest, ClippedRectsForIframedElement) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, ClippedRectsForSubpixelPositionedPlugin) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
|
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -693,9 +670,7 @@ TEST_F(WebPluginContainerTest, TopmostAfterDetachTest) {
|
| }
|
| };
|
|
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| CustomPluginWebFrameClient<TopmostPlugin>
|
| pluginWebFrameClient; // Must outlive webViewHelper.
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| @@ -755,9 +730,7 @@ class CompositedPlugin : public FakeWebPlugin {
|
|
|
| TEST_F(WebPluginContainerTest, CompositedPluginSPv2) {
|
| ScopedSlimmingPaintV2ForTest enableSPv2(true);
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin.html"));
|
| + registerMockedURL("plugin.html");
|
| CustomPluginWebFrameClient<CompositedPlugin> webFrameClient;
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin.html",
|
| @@ -797,9 +770,7 @@ TEST_F(WebPluginContainerTest, CompositedPluginSPv2) {
|
| }
|
|
|
| TEST_F(WebPluginContainerTest, NeedsWheelEvents) {
|
| - URLTestHelpers::registerMockedURLFromBaseURL(
|
| - WebString::fromUTF8(m_baseURL.c_str()),
|
| - WebString::fromUTF8("plugin_container.html"));
|
| + registerMockedURL("plugin_container.html");
|
| TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| WebViewImpl* webView = webViewHelper.initializeAndLoad(
|
|
|