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