Add a test for plug-in unavailability indicator obscurity detection
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jul 2013 17:14:52 +0000 (17:14 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jul 2013 17:14:52 +0000 (17:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119007

Reviewed by Anders Carlsson.

Test: plugins/unavailable-plugin-indicator-obscurity.html

Expose the ability to test whether the unavailable plugin indicator
is obscured via the internals object.

* testing/Internals.cpp:
(WebCore::Internals::isPluginUnavailabilityIndicatorObscured):
* testing/Internals.h:
* testing/Internals.idl:
Expose RenderEmbeddedObject::isReplacementObscured as
internals.isPluginUnavailabilityIndicatorObscured for testing purposes.

Expose the ability to block plug-ins via pluginLoadPolicy to testRunner.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setBlockAllPlugins):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
Add testRunner.setBlockAllPlugins function (and corresponding message to
forward it through to TestController).

* WebKitTestRunner/TestController.cpp:
Initialize m_shouldBlockAllPlugins to false (and drive-by initialize m_handlesAuthenticationChallenges).

(WTR::TestController::createWebViewWithOptions):
Register our pluginLoadPolicy callback.

(WTR::TestController::resetStateToConsistentValues):
Reset m_shouldBlockAllPlugins to false.

(WTR::TestController::pluginLoadPolicy):
Return the existing plugin load policy, unless setBlockAllPlugins(true)
was called, in which case we reject all plugins with kWKPluginLoadPolicyBlocked.

* WebKitTestRunner/TestController.h:
(WTR::TestController::setBlockAllPlugins):

Add a test that ensures that RenderEmbeddedObject accurately detects the
various different ways the unavailable plugin dialog can be obscured.

* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:
* plugins/unavailable-plugin-indicator-obscurity-expected.txt: Added.
* plugins/unavailable-plugin-indicator-obscurity.html: Added.

* Source/autotools/symbols.filter:
Expose RenderEmbeddedObject::isReplacementObscured to internals.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt [new file with mode: 0644]
LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/autotools/symbols.filter
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp

index bed571c..9acda0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2013-07-23  Tim Horton  <timothy_horton@apple.com>
+
+        Add a test for plug-in unavailability indicator obscurity detection
+        https://bugs.webkit.org/show_bug.cgi?id=119007
+
+        Reviewed by Anders Carlsson.
+
+        * Source/autotools/symbols.filter:
+        Expose RenderEmbeddedObject::isReplacementObscured to internals.
+
 2013-07-16  Balazs Kelemen  <kbalazs@webkit.org>
 
         [CMake] Undefined references should be detected at build time
index 1315666..1466aaa 100644 (file)
@@ -1,3 +1,18 @@
+2013-07-23  Tim Horton  <timothy_horton@apple.com>
+
+        Add a test for plug-in unavailability indicator obscurity detection
+        https://bugs.webkit.org/show_bug.cgi?id=119007
+
+        Reviewed by Anders Carlsson.
+
+        Add a test that ensures that RenderEmbeddedObject accurately detects the
+        various different ways the unavailable plugin dialog can be obscured.
+
+        * platform/mac-wk2/TestExpectations:
+        * platform/mac/TestExpectations:
+        * plugins/unavailable-plugin-indicator-obscurity-expected.txt: Added.
+        * plugins/unavailable-plugin-indicator-obscurity.html: Added.
+
 2013-07-23  Zoltan Horvath  <zoltan@webkit.org>
 
         [Qt] REGRESSION(r152906) Modified fast/shapes/shape-inside/shape-inside-overflow.html ref test fails.
index 5ef26fd..6065d08 100644 (file)
@@ -431,6 +431,9 @@ webaudio/codec-tests/vorbis/
 # Asserts in WebKit1-debug only, so reenabling.
 compositing/geometry/fixed-position-flipped-writing-mode.html [ Pass ]
 
+# Plug-in blocking callback doesn't exist in WebKit1, so reenabling.
+plugins/unavailable-plugin-indicator-obscurity.html [ Pass ]
+
 ### END OF (5) Features that are not supported in WebKit1, so skipped in mac/TestExpectations then re-enabled here
 ########################################
 
index 0b30a69..25e9e66 100644 (file)
@@ -1303,3 +1303,6 @@ webkit.org/b/118479 fast/repaint/fixed-right-in-page-scale.html [ Pass Crash ]
 
 webkit.org/b/118900 mathml/presentation/mspace-units.html [ ImageOnlyFailure ]
 webkit.org/b/118856 mathml/presentation/fenced-mi.html [ ImageOnlyFailure ]
+
+# Plug-in blocking callback doesn't exist in WebKit1, so skip and re-enable for WebKit2.
+plugins/unavailable-plugin-indicator-obscurity.html
diff --git a/LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt b/LayoutTests/plugins/unavailable-plugin-indicator-obscurity-expected.txt
new file mode 100644 (file)
index 0000000..f3d187f
--- /dev/null
@@ -0,0 +1,30 @@
+Expected to be obscured:
+'tooSmall' was obscured: true (expected true; PASS)
+'emptyRect' was obscured: true (expected true; PASS)
+'lowOpacity' was obscured: true (expected true; PASS)
+'lowOpacityParent' was obscured: true (expected true; PASS)
+'stackedLowOpacityParents' was obscured: true (expected true; PASS)
+'clippedByParent' was obscured: true (expected true; PASS)
+'visibilityHidden' was obscured: true (expected true; PASS)
+'visibilityHiddenOnParent' was obscured: true (expected true; PASS)
+'pointerEventsBlocked' was obscured: true (expected true; PASS)
+'pointerEventsBlockedOnParent' was obscured: true (expected true; PASS)
+'leftHalfObscured' was obscured: true (expected true; PASS)
+'rightHalfObscured' was obscured: true (expected true; PASS)
+'topHalfObscured' was obscured: true (expected true; PASS)
+'bottomHalfObscured' was obscured: true (expected true; PASS)
+'centerObscured' was obscured: true (expected true; PASS)
+'offScreenTopLeft' was obscured: true (expected true; PASS)
+'offScreenTop' was obscured: true (expected true; PASS)
+'offScreenLeft' was obscured: true (expected true; PASS)
+
+Expected to not be obscured:
+'large' was obscured: false (expected false; PASS)
+'stackedHighOpacityParents' was obscured: false (expected false; PASS)
+'notClippedByParent' was obscured: false (expected false; PASS)
+'pointerEventsBlockedOnObscuringSibling' was obscured: false (expected false; PASS)
+'topQuarterObscured' was obscured: false (expected false; PASS)
+'bottomQuarterObscured' was obscured: false (expected false; PASS)
+
+Passed all tests: true
+
diff --git a/LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html b/LayoutTests/plugins/unavailable-plugin-indicator-obscurity.html
new file mode 100644 (file)
index 0000000..396e042
--- /dev/null
@@ -0,0 +1,160 @@
+<html>
+<head>
+    <title>Test that the plugin unavailability indicator accurately knows if it's clipped.</title>
+    <script>
+    if (window.testRunner) {
+        testRunner.setBlockAllPlugins(true);
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+
+    function log(text) {
+        logElement.appendChild(document.createTextNode(text));
+        logElement.appendChild(document.createElement("br"));
+    }
+
+    function testObscuredPlugins(className, expectedObscured) {
+        var failedAnyTest = false;
+        var expectedObscuredPlugins = document.getElementsByClassName(className);
+        for (var i = 0; i < expectedObscuredPlugins.length; i++) {
+            var plugin = expectedObscuredPlugins[i];
+            var obscured = internals.isPluginUnavailabilityIndicatorObscured(plugin);
+            var passed = expectedObscured == obscured;
+            if (!passed)
+                failedAnyTest = true;
+
+            log("'" + plugin.id + "' was obscured: " + obscured + " (expected " + expectedObscured + "; " + (passed ? "PASS" : "FAIL") + ")");
+        };
+
+        return failedAnyTest;
+    }
+
+    window.onload = function () {
+        logElement = document.getElementById("log");
+
+        if (!window.internals)
+            return;
+
+        setTimeout(function () {
+            log("Expected to be obscured:");
+            var failedAnyTest = testObscuredPlugins("shouldBeObscured", true);
+            log("")
+            log("Expected to not be obscured:");
+            failedAnyTest = failedAnyTest || testObscuredPlugins("shouldNotBeObscured", false);
+            log("");
+            log("Passed all tests: " + !failedAnyTest);
+
+            // Remove the plugins so that we don't have tons of whitespace in the output.
+            while(document.body.firstChild && document.body.firstChild.id != "log") {
+                document.body.removeChild(document.body.firstChild);
+            }
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+    </script>
+    <style>
+    embed {
+        display: block;
+        width: 500px;
+        height: 500px;
+    }
+
+    .cover {
+         background-color: green;
+         width: 100%;
+         height: 100%;
+         position: absolute;
+         top: 0;
+    }
+
+    .container {
+        width: 500px;
+        height: 500px;
+        position: relative;
+    }
+    </style>
+    <body>
+        <embed id="large" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+        <embed id="tooSmall" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="width: 10px; height: 10px;"></embed>
+        <embed id="emptyRect" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="width: 0; height: 0;"></embed>
+
+        <!-- Obscured by opacity -->
+        <embed id="lowOpacity" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="opacity: 0.05;"></embed>
+        <div style="opacity: 0.05;">
+            <embed id="lowOpacityParent" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+        <div style="opacity: 0.2;">
+            <div style="opacity: 0.2;">
+                <embed id="stackedLowOpacityParents" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            </div>
+        </div>
+        <div style="opacity: 0.9;">
+            <div style="opacity: 0.9;">
+                <embed id="stackedHighOpacityParents" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+            </div>
+        </div>
+
+        <!-- Clipped by overflow -->
+        <div style="width: 20px; overflow: hidden;">
+            <embed id="clippedByParent" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+        <div style="width: 20px; overflow: visible;">
+            <embed id="notClippedByParent" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+
+        <!-- Hidden -->
+        <embed id="visibilityHidden" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="visibility: hidden;"></embed>
+        <div style="visibility: hidden;">
+            <embed id="visibilityHiddenOnParent" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+
+        <!-- Clicks blocked via pointer-events: none -->
+        <embed id="pointerEventsBlocked" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="pointer-events: none;"></embed>
+        <div style="pointer-events: none;">
+            <embed id="pointerEventsBlockedOnParent" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+        </div>
+        <div class="container">
+            <embed id="pointerEventsBlockedOnObscuringSibling" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="pointer-events: none;"></div>
+        </div>
+
+        <!-- Obscured by siblings -->
+        <div class="container">
+            <embed id="leftHalfObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="width: 50%;"></div>
+        </div>
+        <div class="container">
+            <embed id="rightHalfObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="width: 50%; left: 50%;"></div>
+        </div>
+        <div class="container">
+            <embed id="topHalfObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="height: 50%;"></div>
+        </div>
+        <div class="container">
+            <embed id="bottomHalfObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="height: 50%; top: 50%;"></div>
+        </div>
+        <div class="container">
+            <embed id="topQuarterObscured" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="height: 25%;"></div>
+        </div>
+        <div class="container">
+            <embed id="bottomQuarterObscured" class="shouldNotBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="height: 25%; top: 75%;"></div>
+        </div>
+        <div class="container">
+            <embed id="centerObscured" class="shouldBeObscured" type="application/x-webkit-test-netscape"></embed>
+            <div class="cover" style="width: 20%; height: 20%; top: 40%; left: 40%;"></div>
+        </div>
+
+        <!-- Obscured by scroll clipping -->
+        <embed id="offScreenTopLeft" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="position: absolute; top: -1000px; left: -1000px;"></embed>
+        <embed id="offScreenTop" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="position: absolute; top: -1000px; left: 0;"></embed>
+        <embed id="offScreenLeft" class="shouldBeObscured" type="application/x-webkit-test-netscape" style="position: absolute; top: 0; left: -1000px;"></embed>
+
+        <div id="log"></div>
+    </body>
+</html>
\ No newline at end of file
index d95e355..3a537ed 100644 (file)
@@ -1,3 +1,22 @@
+2013-07-23  Tim Horton  <timothy_horton@apple.com>
+
+        Add a test for plug-in unavailability indicator obscurity detection
+        https://bugs.webkit.org/show_bug.cgi?id=119007
+
+        Reviewed by Anders Carlsson.
+
+        Test: plugins/unavailable-plugin-indicator-obscurity.html
+
+        Expose the ability to test whether the unavailable plugin indicator
+        is obscured via the internals object.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::isPluginUnavailabilityIndicatorObscured):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        Expose RenderEmbeddedObject::isReplacementObscured as
+        internals.isPluginUnavailabilityIndicatorObscured for testing purposes.
+
 2013-07-23  Zan Dobersek  <zdobersek@igalia.com>
 
         [Soup] Clean up header inclusions in ResourceRequest(Soup), SocketStreamHandle
index 8085e00..eefc902 100644 (file)
@@ -78,6 +78,7 @@
 #include "PrintContext.h"
 #include "PseudoElement.h"
 #include "Range.h"
+#include "RenderEmbeddedObject.h"
 #include "RenderMenuList.h"
 #include "RenderObject.h"
 #include "RenderTreeAsText.h"
@@ -2175,4 +2176,21 @@ bool Internals::isVibrating()
 }
 #endif
 
+bool Internals::isPluginUnavailabilityIndicatorObscured(Element* element, ExceptionCode& ec)
+{
+    if (!element) {
+        ec = INVALID_ACCESS_ERR;
+        return false;
+    }
+
+    RenderObject* renderer = element->renderer();
+    if (!renderer || !renderer->isEmbeddedObject()) {
+        ec = INVALID_ACCESS_ERR;
+        return false;
+    }
+
+    RenderEmbeddedObject* embed = toRenderEmbeddedObject(renderer);
+    return embed->isReplacementObscured();
+}
+
 }
index 1dd900a..25ba449 100644 (file)
@@ -325,6 +325,8 @@ public:
     bool isVibrating();
 #endif
 
+    bool isPluginUnavailabilityIndicatorObscured(Element*, ExceptionCode&);
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;
index f9d833d..9622e50 100644 (file)
     boolean isVibrating();
 #endif
 
+    [RaisesException] boolean isPluginUnavailabilityIndicatorObscured(Element element);
+
     [RaisesException] ClientRect selectionBounds();
 };
index 4a7a419..4a66ac6 100644 (file)
@@ -323,6 +323,7 @@ _ZN7WebCore13ScriptGCEvent11getHeapSizeERNS_8HeapInfoE;
 _ZN7WebCore28notImplementedLoggingChannelEv;
 _ZN7WebCore7toUInt8EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE;
 _ZN7WebCore6toInt8EPN3JSC9ExecStateENS0_7JSValueENS_30IntegerConversionConfigurationE;
+_ZNK7WebCore20RenderEmbeddedObject21isReplacementObscuredEv;
 
 local:
 _Z*;
index 64fc119..63e8407 100644 (file)
@@ -1,3 +1,37 @@
+2013-07-23  Tim Horton  <timothy_horton@apple.com>
+
+        Add a test for plug-in unavailability indicator obscurity detection
+        https://bugs.webkit.org/show_bug.cgi?id=119007
+
+        Reviewed by Anders Carlsson.
+
+        Expose the ability to block plug-ins via pluginLoadPolicy to testRunner.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setBlockAllPlugins):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        Add testRunner.setBlockAllPlugins function (and corresponding message to
+        forward it through to TestController).
+
+        * WebKitTestRunner/TestController.cpp:
+        Initialize m_shouldBlockAllPlugins to false (and drive-by initialize m_handlesAuthenticationChallenges).
+
+        (WTR::TestController::createWebViewWithOptions):
+        Register our pluginLoadPolicy callback.
+
+        (WTR::TestController::resetStateToConsistentValues):
+        Reset m_shouldBlockAllPlugins to false.
+
+        (WTR::TestController::pluginLoadPolicy):
+        Return the existing plugin load policy, unless setBlockAllPlugins(true)
+        was called, in which case we reject all plugins with kWKPluginLoadPolicyBlocked.
+
+        * WebKitTestRunner/TestController.h:
+        (WTR::TestController::setBlockAllPlugins):
+
 2013-07-21  Andreas Kling  <akling@apple.com>
 
         KURL creates duplicate strings when completing data: URIs.
index ce647e2..d14ab2a 100644 (file)
@@ -190,5 +190,8 @@ interface TestRunner {
 
     // Secure text input mode (Mac only)
     readonly attribute boolean secureEventInputIsEnabled;
+    
+    // Override plugin load policy.
+    void setBlockAllPlugins(boolean shouldBlock);
 };
 
index a696600..be013f2 100644 (file)
@@ -812,4 +812,11 @@ bool TestRunner::secureEventInputIsEnabled() const
     return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData));
 }
 
+void TestRunner::setBlockAllPlugins(bool shouldBlock)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBlockAllPlugins"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(shouldBlock));
+    WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
+}
+
 } // namespace WTR
index ef0ea8c..0c91645 100644 (file)
@@ -166,6 +166,8 @@ public:
     // Audio testing.
     void setAudioResult(JSContextRef, JSValueRef data);
 
+    void setBlockAllPlugins(bool shouldBlock);
+
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText, Audio, DOMAsWebArchive };
     WhatToDump whatToDump() const { return m_whatToDump; }
 
index c234569..63e0330 100644 (file)
@@ -112,6 +112,8 @@ TestController::TestController(int argc, const char* argv[])
     , m_isGeolocationPermissionAllowed(false)
     , m_policyDelegateEnabled(false)
     , m_policyDelegatePermissive(false)
+    , m_handlesAuthenticationChallenges(false)
+    , m_shouldBlockAllPlugins(false)
 {
     initialize(argc, argv);
     controller = this;
@@ -487,7 +489,7 @@ void TestController::createWebViewWithOptions(WKDictionaryRef options)
         0, // didLayout
         0, // pluginLoadPolicy_deprecatedForUseWithV2
         0, // pluginDidFail
-        0, // pluginLoadPolicy
+        pluginLoadPolicy, // pluginLoadPolicy
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
 
@@ -625,6 +627,8 @@ bool TestController::resetStateToConsistentValues()
     m_authenticationUsername = String();
     m_authenticationPassword = String();
 
+    m_shouldBlockAllPlugins = false;
+
     // Reset main page back to about:blank
     m_doneResetting = false;
 
@@ -1077,6 +1081,18 @@ void TestController::processDidCrash(WKPageRef page, const void* clientInfo)
     static_cast<TestController*>(const_cast<void*>(clientInfo))->processDidCrash();
 }
 
+WKPluginLoadPolicy TestController::pluginLoadPolicy(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo)
+{
+    return static_cast<TestController*>(const_cast<void*>(clientInfo))->pluginLoadPolicy(page, currentPluginLoadPolicy, pluginInformation, unavailabilityDescription);
+}
+
+WKPluginLoadPolicy TestController::pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription)
+{
+    if (m_shouldBlockAllPlugins)
+        return kWKPluginLoadPolicyBlocked;
+    return currentPluginLoadPolicy;
+}
+
 void TestController::didCommitLoadForFrame(WKPageRef page, WKFrameRef frame)
 {
     if (!WKFrameIsMainFrame(frame))
index dee2683..f6debdd 100644 (file)
@@ -98,6 +98,8 @@ public:
     void setAuthenticationUsername(String username) { m_authenticationUsername = username; }
     void setAuthenticationPassword(String password) { m_authenticationPassword = password; }
 
+    void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
+
 private:
     void initialize(int argc, const char* argv[]);
     void createWebViewWithOptions(WKDictionaryRef);
@@ -134,6 +136,10 @@ private:
     static void processDidCrash(WKPageRef, const void* clientInfo);
     void processDidCrash();
 
+    static WKPluginLoadPolicy pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription, const void* clientInfo);
+    WKPluginLoadPolicy pluginLoadPolicy(WKPageRef, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInformation, WKStringRef* unavailabilityDescription);
+    
+
     static void decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef, const void*);
     void decidePolicyForNotificationPermissionRequest(WKPageRef, WKSecurityOriginRef, WKNotificationPermissionRequestRef);
 
@@ -207,6 +213,8 @@ private:
     String m_authenticationUsername;
     String m_authenticationPassword;
 
+    bool m_shouldBlockAllPlugins;
+
 #if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
     OwnPtr<EventSenderProxy> m_eventSenderProxy;
 #endif
index ce9f551..69236bf 100644 (file)
@@ -651,6 +651,13 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetBlockAllPlugins")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef shouldBlock = static_cast<WKBooleanRef>(messageBody);
+        TestController::shared().setBlockAllPlugins(WKBooleanGetValue(shouldBlock));
+        return;
+    }
+
     ASSERT_NOT_REACHED();
 }