diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/third_party/WebKit/Source/testing/plugin/Tests | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit/Source/testing/plugin/Tests')
22 files changed, 0 insertions, 1677 deletions
diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/DocumentOpenInDestroyStream.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/DocumentOpenInDestroyStream.cpp deleted file mode 100644 index 36fb4b9ba7b..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/DocumentOpenInDestroyStream.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -extern bool testDocumentOpen(NPP npp); - -// Call document.open from NPP_DestroyStream. - -class DocumentOpenInDestroyStream : public PluginTest { -public: - DocumentOpenInDestroyStream(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_shouldOpen(true) - { - } - -private: - virtual NPError NPP_DestroyStream(NPStream*, NPReason) - { - if (m_shouldOpen) { - testDocumentOpen(m_npp); - m_shouldOpen = false; - } - - return NPERR_NO_ERROR; - } - - bool m_shouldOpen; -}; - -static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSAfterRemovingPluginElement.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSAfterRemovingPluginElement.cpp deleted file mode 100644 index 4b5d3e01dea..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSAfterRemovingPluginElement.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Executing JS after removing the plugin element from the document should not crash. - -class EvaluateJSAfterRemovingPluginElement : public PluginTest { -public: - EvaluateJSAfterRemovingPluginElement(NPP, const string& identifier); - -private: - virtual NPError NPP_DestroyStream(NPStream*, NPReason); - - bool m_didExecuteScript; -}; - -static PluginTest::Register<EvaluateJSAfterRemovingPluginElement> registrar("evaluate-js-after-removing-plugin-element"); - -EvaluateJSAfterRemovingPluginElement::EvaluateJSAfterRemovingPluginElement(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didExecuteScript(false) -{ - waitUntilDone(); -} - -NPError EvaluateJSAfterRemovingPluginElement::NPP_DestroyStream(NPStream*, NPReason) -{ - if (m_didExecuteScript) - return NPERR_NO_ERROR; - m_didExecuteScript = true; - - executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugin.parentElement.removeChild(plugin);"); - executeScript("document.body.appendChild(document.createTextNode('Executing script after removing the plugin element from the document succeeded.'));"); - notifyDone(); - - return NPERR_NO_ERROR; -} diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSWithinNPP_New.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSWithinNPP_New.cpp deleted file mode 100644 index c066db59f89..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/EvaluateJSWithinNPP_New.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Executing JS within NPP_New when initializing asynchronously should not be able to deadlock with the WebProcess - -class EvaluteJSWithinNPP_New : public PluginTest { -public: - EvaluteJSWithinNPP_New(NPP, const string& identifier); - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *); - -}; - -EvaluteJSWithinNPP_New::EvaluteJSWithinNPP_New(NPP npp, const string& identifier) - : PluginTest(npp, identifier) -{ -} - -NPError EvaluteJSWithinNPP_New::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) -{ - // Give the WebProcess enough time to be deadlocked waiting for the PluginProcess. - usleep(15000); - executeScript("var theLocation = window.location;"); - return NPERR_NO_ERROR; -} - -static PluginTest::Register<EvaluteJSWithinNPP_New> registrar("evalute-js-within-npp-new"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/FormValue.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/FormValue.cpp deleted file mode 100644 index 738e192ebfd..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/FormValue.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" -#include <string.h> - -extern NPNetscapeFuncs *browser; - -class FormValue : public PluginTest { -public: - FormValue(NPP npp, const std::string& identifier) - : PluginTest(npp, identifier) - { - } - virtual NPError NPP_GetValue(NPPVariable, void*); -}; - -NPError FormValue::NPP_GetValue(NPPVariable variable, void *value) -{ - if (variable == NPPVformValue) { - static const char formValueText[] = "Plugin form value"; - *((void**)value) = browser->memalloc(sizeof(formValueText)); - if (!*((void**)value)) - return NPERR_OUT_OF_MEMORY_ERROR; - strncpy(*((char**)value), formValueText, sizeof(formValueText)); - return NPERR_NO_ERROR; - } - return NPERR_GENERIC_ERROR; -} - -static PluginTest::Register<FormValue> formValue("form-value"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp deleted file mode 100644 index f6f39ab04d4..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> - -using namespace std; - -// From NPP_New, call NPN_GetURLNotify with a URL that fails to load (NPP_NewStream won't be called). -// The plug-in should still get a NPP_URLNotify indicating that the load failed. -static const char *urlThatFailsToLoad = "foo://bar/"; - -class GetURLNotifyWithURLThatFailsToLoad : public PluginTest { -public: - GetURLNotifyWithURLThatFailsToLoad(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - NPN_GetURLNotify(urlThatFailsToLoad, 0, reinterpret_cast<void*>(0x12345678)); - return NPERR_NO_ERROR; - } - - bool NPP_URLNotify(const char* url, NPReason reason, void* notifyData) - { - bool didFail = false; - - if (strcmp(url, urlThatFailsToLoad)) - didFail = true; - - if (reason != NPRES_NETWORK_ERR) - didFail = true; - - if (notifyData != reinterpret_cast<void*>(0x12345678)) - didFail = true; - - if (!didFail) - executeScript("testSucceeded()"); - else - executeScript("notifyDone()"); - return true; - } -}; - -static PluginTest::Register<GetURLNotifyWithURLThatFailsToLoad> getURLWithJavaScriptURLDestroyingPlugin("get-url-notify-with-url-that-fails-to-load"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURL.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURL.cpp deleted file mode 100644 index 64a69a36115..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURL.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> -#include <vector> - -using namespace std; - -const char *javaScriptURL = "javascript:'Hello, ' + 'World!'"; -const char *javaScriptResult = "Hello, World!"; - -// Test that evaluating a javascript: URL will send a stream with the result of the evaluation. -// Test that evaluating JavaScript using NPN_GetURL will a stream with result of the evaluation. -class GetURLWithJavaScriptURL : public PluginTest { -public: - GetURLWithJavaScriptURL(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didFail(false) - { - } - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - NPN_GetURL(javaScriptURL, 0); - return NPERR_NO_ERROR; - } - - NPError NPP_NewStream(NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) - { - stream->pdata = this; - - if (strcmp(stream->url, javaScriptURL)) - m_didFail = true; - - if (stream->end != strlen(javaScriptResult)) - m_didFail = true; - - *stype = NP_NORMAL; - return NPERR_NO_ERROR; - } - - NPError NPP_DestroyStream(NPStream* stream, NPReason reason) - { - if (stream->pdata != this) - m_didFail = true; - - if (reason != NPRES_DONE) - m_didFail = true; - - if (m_data.size() != stream->end) - m_didFail = true; - - m_data.push_back('\0'); - - if (strcmp(&m_data[0], javaScriptResult)) - m_didFail = true; - - if (!m_didFail) - executeScript("testSucceeded()"); - else - executeScript("notifyDone()"); - - return NPERR_NO_ERROR; - } - - int32_t NPP_WriteReady(NPStream* stream) - { - if (stream->pdata != this) - m_didFail = true; - - return 2; - } - - int32_t NPP_Write(NPStream* stream, int32_t offset, int32_t len, void* buffer) - { - if (stream->pdata != this) - m_didFail = true; - - m_data.insert(m_data.end(), static_cast<char*>(buffer), static_cast<char*>(buffer) + len); - return len; - } - - vector<char> m_data; - bool m_didFail; -}; - -static PluginTest::Register<GetURLWithJavaScriptURL> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp deleted file mode 100644 index aa1fc11cced..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -// From NPP_New, call NPN_GetURL to evaluate JavaScript that destroys the plug-in. - -class GetURLWithJavaScriptURLDestroyingPlugin : public PluginTest { -public: - GetURLWithJavaScriptURLDestroyingPlugin(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - NPN_GetURL("javascript:removePlugin()", 0); - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<GetURLWithJavaScriptURLDestroyingPlugin> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url-destroying-plugin"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp deleted file mode 100644 index 887e1521eb3..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Trying to get the user agent with a null instance from NPP_New. - -class GetUserAgentWithNullNPPFromNPPNew : public PluginTest { -public: - GetUserAgentWithNullNPPFromNPPNew(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - if (!browser->uagent(0)) - pluginLog(m_npp, "FAILURE: Null user agent returned."); - else - pluginLog(m_npp, "SUCCESS!"); - - return NPERR_NO_ERROR; - } - -}; - -static PluginTest::Register<GetUserAgentWithNullNPPFromNPPNew> getUserAgentWithNullNPPFromNPPNew("get-user-agent-with-null-npp-from-npp-new"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/InvokeDestroysPluginWithinNPP_New.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/InvokeDestroysPluginWithinNPP_New.cpp deleted file mode 100644 index a9a9b8fa08c..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/InvokeDestroysPluginWithinNPP_New.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Executing JS within NPP_New when initializing asynchronously should not be able to deadlock with the WebProcess - -class InvokeDestroysPluginWithinNPP_New : public PluginTest { -public: - InvokeDestroysPluginWithinNPP_New(NPP, const string& identifier); - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *); - -}; - -InvokeDestroysPluginWithinNPP_New::InvokeDestroysPluginWithinNPP_New(NPP npp, const string& identifier) - : PluginTest(npp, identifier) -{ -} - -NPError InvokeDestroysPluginWithinNPP_New::NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) -{ - // Give the WebProcess enough time to be deadlocked waiting for the PluginProcess if things aren't working correctly. - usleep(15000); - - NPObject* windowObject = 0; - if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR) - return NPERR_GENERIC_ERROR; - - if (!windowObject) - return NPERR_GENERIC_ERROR; - - NPVariant result; - if (!NPN_Invoke(windowObject, NPN_GetStringIdentifier("removePluginElement"), 0, 0, &result)) - return NPERR_GENERIC_ERROR; - - return NPERR_NO_ERROR; -} - -static PluginTest::Register<InvokeDestroysPluginWithinNPP_New> registrar("invoke-destroys-plugin-within-npp-new"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/LeakWindowScriptableObject.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/LeakWindowScriptableObject.cpp deleted file mode 100644 index 93f52a28e60..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/LeakWindowScriptableObject.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -class LeakWindowScriptableObject : public PluginTest { -public: - LeakWindowScriptableObject(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - // Get a new reference to the window script object. - NPObject* window; - if (NPN_GetValue(NPNVWindowNPObject, &window) != NPERR_NO_ERROR) { - log("Fail: Cannot fetch window script object"); - return NPERR_NO_ERROR; - } - - // Get another reference to the same object via window.self. - NPIdentifier self_name = NPN_GetStringIdentifier("self"); - NPVariant window_self_variant; - if (!NPN_GetProperty(window, self_name, &window_self_variant)) { - log("Fail: Cannot query window.self"); - return NPERR_NO_ERROR; - } - if (!NPVARIANT_IS_OBJECT(window_self_variant)) { - log("Fail: window.self is not an object"); - return NPERR_NO_ERROR; - } - - // Leak both references to the window script object. - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<LeakWindowScriptableObject> leakWindowScriptableObject("leak-window-scriptable-object"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/LogNPPSetWindow.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/LogNPPSetWindow.cpp deleted file mode 100644 index 90481e2056c..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/LogNPPSetWindow.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <stdio.h> - -using namespace std; - -class LogNPPSetWindow : public PluginTest { -public: - LogNPPSetWindow(NPP, const string& identifier); - -private: - virtual NPError NPP_SetWindow(NPWindow*); -}; - -LogNPPSetWindow::LogNPPSetWindow(NPP npp, const string& identifier) - : PluginTest(npp, identifier) -{ -} - -NPError LogNPPSetWindow::NPP_SetWindow(NPWindow* window) -{ - char message[1024]; - snprintf(message, 1024, "NPP_SetWindow: %s window, Rect {%i, %i, %i, %i}, Clip Rect {%i, %i, %i, %i}, Type %i", - window->window ? "non-NULL" : "NULL", window->x, window->y, window->width, window->height, - window->clipRect.left, window->clipRect.top, window->clipRect.right, window->clipRect.bottom, - window->type); - - char script[1536]; - snprintf(script, 1536, "window.setTimeout('windowWasSet(\"%s\");', 0);", message); - - executeScript(script); - - return NPERR_NO_ERROR; -} - -static PluginTest::Register<LogNPPSetWindow> registrar("log-npp-set-window"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPDeallocateCalledBeforeNPShutdown.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPDeallocateCalledBeforeNPShutdown.cpp deleted file mode 100644 index fb0f2c4615c..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPDeallocateCalledBeforeNPShutdown.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -static bool wasShutdownCalled = false; - -class NPDeallocateCalledBeforeNPShutdown : public PluginTest { -public: - NPDeallocateCalledBeforeNPShutdown(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - // This is the test object. - class TestObject : public Object<TestObject> { - public: - ~TestObject() - { - if (wasShutdownCalled) - indicateTestFailure(); - } - }; - - // This is the scriptable object. It has a single "testObject" property. - class ScriptableObject : public Object<ScriptableObject> { - public: - bool hasProperty(NPIdentifier propertyName) - { - return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject"); - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject")) - return false; - - NPObject* testObject = TestObject::create(pluginTest()); - OBJECT_TO_NPVARIANT(testObject, *result); - return true; - } - }; - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - registerNPShutdownFunction(shutdown); - - return NPERR_NO_ERROR; - } - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = ScriptableObject::create(this); - - return NPERR_NO_ERROR; - } - - static void shutdown() - { - wasShutdownCalled = true; - } - -}; - -static PluginTest::Register<NPDeallocateCalledBeforeNPShutdown> npRuntimeObjectFromDestroyedPlugin("np-deallocate-called-before-np-shutdown"); - diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPNewFails.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPNewFails.cpp deleted file mode 100644 index afe344aad6b..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPNewFails.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> - -using namespace std; - -class NPPNewFails : public PluginTest { -public: - NPPNewFails(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) - { - return NPERR_GENERIC_ERROR; - } -}; - -static PluginTest::Register<NPPNewFails> nppNewFails("npp-new-fails"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPSetWindowCalledDuringDestruction.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPSetWindowCalledDuringDestruction.cpp deleted file mode 100644 index 50af959057e..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPPSetWindowCalledDuringDestruction.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2011 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// NPP_SetWindow should be called with a null window handle as destruction begins on non-Mac platforms. - -class NPPSetWindowCalledDuringDestruction : public PluginTest { -public: - NPPSetWindowCalledDuringDestruction(NPP, const string& identifier); - - void setWillBeDestroyed() { m_willBeDestroyed = true; } - -private: - struct ScriptObject : Object<ScriptObject> { - bool hasMethod(NPIdentifier); - bool invoke(NPIdentifier, const NPVariant*, uint32_t, NPVariant*); - }; - - virtual NPError NPP_GetValue(NPPVariable, void*); - virtual NPError NPP_SetWindow(NPWindow*); - virtual NPError NPP_Destroy(NPSavedData**); - - bool m_willBeDestroyed; - bool m_setWindowCalledBeforeDestruction; - bool m_setWindowCalledDuringDestruction; -}; - -static PluginTest::Register<NPPSetWindowCalledDuringDestruction> registrar("npp-set-window-called-during-destruction"); - -NPPSetWindowCalledDuringDestruction::NPPSetWindowCalledDuringDestruction(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_willBeDestroyed(false) - , m_setWindowCalledBeforeDestruction(false) - , m_setWindowCalledDuringDestruction(false) -{ -} - -NPError NPPSetWindowCalledDuringDestruction::NPP_GetValue(NPPVariable variable, void* value) -{ - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *static_cast<NPObject**>(value) = ScriptObject::create(this); - - return NPERR_NO_ERROR; -} - -NPError NPPSetWindowCalledDuringDestruction::NPP_SetWindow(NPWindow* window) -{ - if (m_willBeDestroyed) { - m_setWindowCalledDuringDestruction = true; - if (!m_setWindowCalledBeforeDestruction) { - log("Fail: setWillBeDestroyed() was called before the initial NPP_SetWindow call"); - return NPERR_NO_ERROR; - } -#ifndef XP_MACOSX - if (window->window) - log("Fail: NPP_SetWindow passed a non-null window during plugin destruction"); -#endif - return NPERR_NO_ERROR; - } - - if (m_setWindowCalledBeforeDestruction) { - log("Fail: NPP_SetWindow called more than once before plugin destruction"); - return NPERR_NO_ERROR; - } - - m_setWindowCalledBeforeDestruction = true; - return NPERR_NO_ERROR; -} - -NPError NPPSetWindowCalledDuringDestruction::NPP_Destroy(NPSavedData**) -{ -#ifdef XP_MACOSX - bool shouldHaveBeenCalledDuringDestruction = false; -#else - bool shouldHaveBeenCalledDuringDestruction = true; -#endif - - if (m_setWindowCalledDuringDestruction == shouldHaveBeenCalledDuringDestruction) - log("Success: NPP_SetWindow %s called during plugin destruction", shouldHaveBeenCalledDuringDestruction ? "was" : "was not"); - else - log("Fail: NPP_SetWindow %s called during plugin destruction", shouldHaveBeenCalledDuringDestruction ? "was not" : "was"); - - return NPERR_NO_ERROR; -} - -bool NPPSetWindowCalledDuringDestruction::ScriptObject::hasMethod(NPIdentifier methodName) -{ - return methodName == pluginTest()->NPN_GetStringIdentifier("setWillBeDestroyed"); -} - -bool NPPSetWindowCalledDuringDestruction::ScriptObject::invoke(NPIdentifier identifier, const NPVariant*, uint32_t, NPVariant*) -{ - assert(identifier == pluginTest()->NPN_GetStringIdentifier("setWillBeDestroyed")); - static_cast<NPPSetWindowCalledDuringDestruction*>(pluginTest())->setWillBeDestroyed(); - return true; -} diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeCallsWithNullNPP.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeCallsWithNullNPP.cpp deleted file mode 100644 index 84e9714dfba..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeCallsWithNullNPP.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -class NPRuntimeCallsWithNullNPP : public PluginTest { -public: - NPRuntimeCallsWithNullNPP(NPP npp, const std::string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) - { - NPObject* windowObject = 0; - if (NPN_GetValue(NPNVWindowNPObject, &windowObject) != NPERR_NO_ERROR || !windowObject) - return NPERR_GENERIC_ERROR; - - NPIdentifier alertIdentifier = NPN_GetStringIdentifier("alert"); - if (!PluginTest::netscapeFuncs()->hasmethod(0, windowObject, alertIdentifier)) { - NPN_ReleaseObject(windowObject); - return NPERR_GENERIC_ERROR; - } - - NPIdentifier documentIdentifier = NPN_GetStringIdentifier("document"); - NPVariant variant; - if (!PluginTest::netscapeFuncs()->getproperty(0, windowObject, documentIdentifier, &variant)) { - NPN_ReleaseObject(windowObject); - return NPERR_GENERIC_ERROR; - } - NPN_ReleaseVariantValue(&variant); - - NPN_ReleaseObject(windowObject); - - executeScript("document.getElementById('result').innerHTML = 'SUCCESS!'"); - notifyDone(); - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<NPRuntimeCallsWithNullNPP> npRuntimeCallsWithNullNPP("npruntime-calls-with-null-npp"); - - diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp deleted file mode 100644 index 96e9d833769..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -class NPRuntimeObjectFromDestroyedPlugin : public PluginTest { -public: - NPRuntimeObjectFromDestroyedPlugin(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - // This is the test object. - class TestObject : public Object<TestObject> { }; - - // This is the scriptable object. It has a single "testObject" property and an "evaluate" function. - class ScriptableObject : public Object<ScriptableObject> { - public: - bool hasMethod(NPIdentifier methodName) - { - return identifierIs(methodName, "evaluate"); - } - - bool invoke(NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result) - { - if (!identifierIs(methodName, "evaluate")) - return false; - - if (argCount != 1 || !NPVARIANT_IS_STRING(args[0])) - return false; - - return pluginTest()->executeScript(&NPVARIANT_TO_STRING(args[0]), result); - } - - bool hasProperty(NPIdentifier propertyName) - { - return identifierIs(propertyName, "testObject"); - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject")) - return false; - - NPObject* testObject = TestObject::create(pluginTest()); - OBJECT_TO_NPVARIANT(testObject, *result); - return true; - } - }; - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = ScriptableObject::create(this); - - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin"); - diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeRemoveProperty.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeRemoveProperty.cpp deleted file mode 100644 index f817dcbe568..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NPRuntimeRemoveProperty.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> - -using namespace std; - -class NPRuntimeRemoveProperty : public PluginTest { -public: - NPRuntimeRemoveProperty(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - struct TestObject : Object<TestObject> { - public: - TestObject() - : m_lastRemovedProperty(0) - { - } - - bool hasProperty(NPIdentifier propertyName) - { - if (identifierIs(propertyName, "lastRemovedProperty")) - return true; - - return false; - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - assert(identifierIs(propertyName, "lastRemovedProperty")); - - if (!m_lastRemovedProperty) - return false; - - if (pluginTest()->NPN_IdentifierIsString(m_lastRemovedProperty)) { - char* lastRemovedPropertyName = pluginTest()->NPN_UTF8FromIdentifier(m_lastRemovedProperty); - - STRINGZ_TO_NPVARIANT(lastRemovedPropertyName, *result); - return true; - } - - int intIdentifier = pluginTest()->NPN_IntFromIdentifier(m_lastRemovedProperty); - DOUBLE_TO_NPVARIANT(intIdentifier, *result); - return true; - } - - bool removeProperty(NPIdentifier propertyName) - { - m_lastRemovedProperty = propertyName; - return true; - } - - private: - NPIdentifier m_lastRemovedProperty; - }; - - struct PluginObject : Object<PluginObject> { - public: - PluginObject() - : m_testObject(0) - { - } - - ~PluginObject() - { - if (m_testObject) - pluginTest()->NPN_ReleaseObject(m_testObject); - } - - bool hasMethod(NPIdentifier methodName) - { - if (identifierIs(methodName, "testRemoveProperty")) - return true; - - return false; - } - - bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) - { - assert(identifierIs(methodName, "testRemoveProperty")); - - if (argumentCount != 2) - return false; - - if (!NPVARIANT_IS_OBJECT(arguments[0])) - return false; - - if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(arguments[1])) - return false; - - NPIdentifier propertyName; - if (NPVARIANT_IS_STRING(arguments[1])) { - string propertyNameString(arguments[1].value.stringValue.UTF8Characters, - arguments[1].value.stringValue.UTF8Length); - - propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNameString.c_str()); - } else { - int32_t number = static_cast<int32_t>(arguments[1].value.doubleValue); - propertyName = pluginTest()->NPN_GetIntIdentifier(number); - } - - pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName); - - VOID_TO_NPVARIANT(*result); - return true; - } - - bool hasProperty(NPIdentifier propertyName) - { - if (identifierIs(propertyName, "testObject")) - return true; - - return false; - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - assert(identifierIs(propertyName, "testObject")); - - if (!m_testObject) - m_testObject = TestObject::create(pluginTest()); - - OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *result); - return true; - } - - private: - NPObject* m_testObject; - }; - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = PluginObject::create(this); - - return NPERR_NO_ERROR; - } - -}; - -static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("npruntime-remove-property"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NullNPPGetValuePointer.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/NullNPPGetValuePointer.cpp deleted file mode 100644 index 9e4e976f00a..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/NullNPPGetValuePointer.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Passing null for our NPP_GetValue function pointer should not crash. - -class NullNPPGetValuePointer : public PluginTest { -public: - NullNPPGetValuePointer(NPP, const string& identifier); - -private: - virtual NPError NPP_Destroy(NPSavedData**); - virtual NPError NPP_GetValue(NPPVariable, void* value); - - NPP_GetValueProcPtr m_originalNPPGetValuePointer; -}; - -static PluginTest::Register<NullNPPGetValuePointer> registrar("null-npp-getvalue-pointer"); - -NullNPPGetValuePointer::NullNPPGetValuePointer(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_originalNPPGetValuePointer(pluginFunctions->getvalue) -{ - // Be sneaky and null out the getvalue pointer the browser is holding. This simulates a plugin - // that doesn't implement NPP_GetValue (like Shockwave Director 10.3 on Windows). Note that if - // WebKit copies the NPPluginFuncs struct this technique will have no effect and WebKit will - // call into our NPP_GetValue implementation. - pluginFunctions->getvalue = 0; -} - -NPError NullNPPGetValuePointer::NPP_Destroy(NPSavedData**) -{ - // Set the NPP_GetValue pointer back the way it was before we mucked with it so we don't mess - // up future uses of the plugin module. - pluginFunctions->getvalue = m_originalNPPGetValuePointer; - return NPERR_NO_ERROR; -} - -NPError NullNPPGetValuePointer::NPP_GetValue(NPPVariable, void*) -{ - pluginLog(m_npp, "NPP_GetValue was called but should not have been. Maybe WebKit copied the NPPluginFuncs struct, which would invalidate this test."); - return NPERR_GENERIC_ERROR; -} diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PassDifferentNPPStruct.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/PassDifferentNPPStruct.cpp deleted file mode 100644 index d78a29bae2f..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PassDifferentNPPStruct.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include "PluginObject.h" - -using namespace std; - -// Passing a different NPP struct that has the same ndata value as the one passed to NPP_New should -// not trigger an assertion failure. - -class PassDifferentNPPStruct : public PluginTest { -public: - PassDifferentNPPStruct(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - , m_didReceiveInitialSetWindowCall(false) - { - } - -private: - virtual NPError NPP_SetWindow(NPWindow* window) - { - if (m_didReceiveInitialSetWindowCall) - return NPERR_NO_ERROR; - m_didReceiveInitialSetWindowCall = true; - - NPP oldNPP = m_npp; - NPP_t differentNPP = *m_npp; - m_npp = &differentNPP; - - NPBool privateMode; - NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); - - m_npp = oldNPP; - - if (error != NPERR_NO_ERROR) { - log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct failed with error %d", error); - notifyDone(); - return NPERR_GENERIC_ERROR; - } - log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succeeded"); - notifyDone(); - return NPERR_NO_ERROR; - } - - bool m_didReceiveInitialSetWindowCall; -}; - -static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass-different-npp-struct"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableNPObjectInvokeDefault.cpp deleted file mode 100644 index 34d209b3ed6..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableNPObjectInvokeDefault.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -// A test where the plug-ins scriptable object either has or doesn't have an invokeDefault function. -class PluginScriptableNPObjectInvokeDefault : public PluginTest { -public: - PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> { }; - - struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> { - public: - bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) - { - INT32_TO_NPVARIANT(1, *result); - return true; - } - }; - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - NPObject* object; - if (identifier() == "plugin-scriptable-npobject-invoke-default") - object = NPObjectWithInvokeDefault::create(this); - else - object = NPObjectWithoutInvokeDefault::create(this); - - *(NPObject**)value = object; - - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default"); -static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableObjectOverridesAllProperties.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableObjectOverridesAllProperties.cpp deleted file mode 100644 index a70d47bea62..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/PluginScriptableObjectOverridesAllProperties.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <stdio.h> -#include <string.h> - -using namespace std; - -class PluginScriptableObjectOverridesAllProperties : public PluginTest { -public: - PluginScriptableObjectOverridesAllProperties(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - class PluginObject : public Object<PluginObject> { - public: - PluginObject() - { - } - - ~PluginObject() - { - } - - bool hasProperty(NPIdentifier propertyName) - { - return true; - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - static const char* message = "My name is "; - char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName); - - int bufferLength = strlen(propertyString) + strlen(message) + 1; - char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength)); - snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString); - - STRINGZ_TO_NPVARIANT(resultBuffer, *result); - - return true; - } - }; - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = PluginObject::create(this); - - return NPERR_NO_ERROR; - } - -}; - -static PluginTest::Register<PluginScriptableObjectOverridesAllProperties> pluginScriptableObjectOverridesAllProperties("plugin-scriptable-object-overrides-all-properties"); diff --git a/chromium/third_party/WebKit/Source/testing/plugin/Tests/SlowNPPNew.cpp b/chromium/third_party/WebKit/Source/testing/plugin/Tests/SlowNPPNew.cpp deleted file mode 100644 index 8638c78ae43..00000000000 --- a/chromium/third_party/WebKit/Source/testing/plugin/Tests/SlowNPPNew.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -#include <string.h> - -using namespace std; - -class SlowNPPNew : public PluginTest { -public: - SlowNPPNew(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - class PluginObject : public Object<PluginObject> { - public: - PluginObject() - { - } - - ~PluginObject() - { - } - - bool hasProperty(NPIdentifier propertyName) - { - return true; - } - - bool getProperty(NPIdentifier propertyName, NPVariant* result) - { - static const char* message = "My name is "; - char* propertyString = pluginTest()->NPN_UTF8FromIdentifier(propertyName); - - int bufferLength = strlen(propertyString) + strlen(message) + 1; - char* resultBuffer = static_cast<char*>(pluginTest()->NPN_MemAlloc(bufferLength)); - snprintf(resultBuffer, bufferLength, "%s%s", message, propertyString); - - STRINGZ_TO_NPVARIANT(resultBuffer, *result); - - return true; - } - }; - - virtual NPError NPP_GetValue(NPPVariable variable, void *value) - { - if (variable != NPPVpluginScriptableNPObject) - return NPERR_GENERIC_ERROR; - - *(NPObject**)value = PluginObject::create(this); - - return NPERR_NO_ERROR; - } - - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData *saved) - { - usleep(550000); - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<SlowNPPNew> slowNPPNew("slow-npp-new"); |