| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" |
| 7 |
| 8 #if defined(OS_WIN) |
| 5 #define STRSAFE_NO_DEPRECATE | 9 #define STRSAFE_NO_DEPRECATE |
| 6 #include <strsafe.h> | 10 #include <strsafe.h> |
| 11 #endif |
| 7 #include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" | 12 #include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" |
| 8 | 13 |
| 9 namespace NPAPIClient { | 14 namespace NPAPIClient { |
| 10 | 15 |
| 11 NPObjectProxyTest::NPObjectProxyTest(NPP id, NPNetscapeFuncs *host_functions) | 16 NPObjectProxyTest::NPObjectProxyTest(NPP id, NPNetscapeFuncs *host_functions) |
| 12 : PluginTest(id, host_functions) { | 17 : PluginTest(id, host_functions) { |
| 13 } | 18 } |
| 14 | 19 |
| 15 NPError NPObjectProxyTest::SetWindow(NPWindow* pNPWindow) { | 20 NPError NPObjectProxyTest::SetWindow(NPWindow* pNPWindow) { |
| 16 NPIdentifier document_id = HostFunctions()->getstringidentifier("document"); | 21 NPIdentifier document_id = HostFunctions()->getstringidentifier("document"); |
| 17 NPIdentifier create_text_node_id = HostFunctions()->getstringidentifier("creat
eTextNode"); | 22 NPIdentifier create_text_node_id = HostFunctions()->getstringidentifier("creat
eTextNode"); |
| 18 NPIdentifier append_child_id = HostFunctions()->getstringidentifier("appendChi
ld"); | 23 NPIdentifier append_child_id = HostFunctions()->getstringidentifier("appendChi
ld"); |
| 19 | 24 |
| 20 NPVariant docv; | 25 NPVariant docv; |
| 21 NPObject *window_obj = NULL; | 26 NPObject *window_obj = NULL; |
| 22 HostFunctions()->getvalue(id(), NPNVWindowNPObject, &window_obj); | 27 HostFunctions()->getvalue(id(), NPNVWindowNPObject, &window_obj); |
| 23 | 28 |
| 24 HostFunctions()->getproperty(id(), window_obj, document_id, &docv); | 29 HostFunctions()->getproperty(id(), window_obj, document_id, &docv); |
| 25 NPObject *doc = NPVARIANT_TO_OBJECT(docv); | 30 NPObject *doc = NPVARIANT_TO_OBJECT(docv); |
| 26 | 31 |
| 27 NPVariant strv; | 32 NPVariant strv; |
| 28 #pragma warning(suppress: 4267) | 33 MSVC_SUPPRESS_WARNING(4267); |
| 29 STRINGZ_TO_NPVARIANT("div", strv); | 34 STRINGZ_TO_NPVARIANT("div", strv); |
| 30 | 35 |
| 31 NPVariant textv; | 36 NPVariant textv; |
| 32 HostFunctions()->invoke(id(), doc, create_text_node_id, &strv, 1, &textv); | 37 HostFunctions()->invoke(id(), doc, create_text_node_id, &strv, 1, &textv); |
| 33 | 38 |
| 34 NPVariant v; | 39 NPVariant v; |
| 35 HostFunctions()->invoke(id(), doc, append_child_id, &textv, 1, &v); | 40 HostFunctions()->invoke(id(), doc, append_child_id, &textv, 1, &v); |
| 36 | 41 |
| 37 // If this test failed, then we'd have crashed by now. | 42 // If this test failed, then we'd have crashed by now. |
| 38 SignalTestCompleted(); | 43 SignalTestCompleted(); |
| 39 | 44 |
| 40 return NPERR_NO_ERROR; | 45 return NPERR_NO_ERROR; |
| 41 } | 46 } |
| 42 | 47 |
| 43 } // namespace NPAPIClient | 48 } // namespace NPAPIClient |
| 44 | 49 |
| OLD | NEW |