Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: webkit/glue/plugins/test/plugin_windowless_test.cc

Issue 53106: We need to set the clipping region of the HDC passed in to a windowless flash... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/test/plugin_windowless_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #define STRSAFE_NO_DEPRECATE
6 #include "webkit/glue/plugins/test/plugin_windowless_test.h"
7 #include "webkit/glue/plugins/test/plugin_client.h"
8
9 namespace NPAPIClient {
10
11 WindowlessPluginTest::WindowlessPluginTest(
12 NPP id, NPNetscapeFuncs *host_functions, const std::string& test_name)
13 : PluginTest(id, host_functions),
14 test_name_(test_name) {
15 }
16
17 int16 WindowlessPluginTest::HandleEvent(void* event) {
18
19 NPNetscapeFuncs* browser = NPAPIClient::PluginClient::HostFunctions();
20
21 NPBool supports_windowless = 0;
22 NPError result = browser->getvalue(id(), NPNVSupportsWindowless,
23 &supports_windowless);
24 if ((result != NPERR_NO_ERROR) || (supports_windowless != TRUE)) {
25 SetError("Failed to read NPNVSupportsWindowless value");
26 SignalTestCompleted();
27 return PluginTest::HandleEvent(event);
28 }
29
30 NPEvent* np_event = reinterpret_cast<NPEvent*>(event);
31 if (WM_PAINT == np_event->event &&
32 base::strcasecmp(test_name_.c_str(),
33 "execute_script_delete_in_paint") == 0) {
34 HDC paint_dc = reinterpret_cast<HDC>(np_event->wParam);
35 if (paint_dc == NULL) {
36 SetError("Invalid Window DC passed to HandleEvent for WM_PAINT");
37 SignalTestCompleted();
38 return NPERR_GENERIC_ERROR;
39 }
40
41 HRGN clipping_region = CreateRectRgn(0, 0, 0, 0);
42 if (!GetClipRgn(paint_dc, clipping_region)) {
43 SetError("No clipping region set in window DC");
44 DeleteObject(clipping_region);
45 SignalTestCompleted();
46 return NPERR_GENERIC_ERROR;
47 }
48
49 DeleteObject(clipping_region);
50
51 NPUTF8* urlString = "javascript:DeletePluginWithinScript()";
52 NPUTF8* targetString = NULL;
53 browser->geturl(id(), urlString, targetString);
54 SignalTestCompleted();
55 } else if (WM_MOUSEMOVE == np_event->event &&
56 base::strcasecmp(test_name_.c_str(),
57 "execute_script_delete_in_mouse_move") == 0) {
58 std::string script = "javascript:DeletePluginWithinScript()";
59 NPString script_string;
60 script_string.UTF8Characters = script.c_str();
61 script_string.UTF8Length =
62 static_cast<unsigned int>(script.length());
63
64 NPObject *window_obj = NULL;
65 browser->getvalue(id(), NPNVWindowNPObject, &window_obj);
66 NPVariant result_var;
67 NPError result = browser->evaluate(id(), window_obj,
68 &script_string, &result_var);
69 SignalTestCompleted();
70 }
71 // If this test failed, then we'd have crashed by now.
72 return PluginTest::HandleEvent(event);
73 }
74
75 } // namespace NPAPIClient
OLDNEW
« no previous file with comments | « webkit/glue/plugins/test/plugin_windowless_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698