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

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

Issue 1073003: Added a test for pepper3d. It ensures that we can successfully load a pepper ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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') | webkit/glue/plugins/test/resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #define STRSAFE_NO_DEPRECATE 5 #define STRSAFE_NO_DEPRECATE
6 #include "webkit/glue/plugins/test/plugin_windowless_test.h" 6 #include "webkit/glue/plugins/test/plugin_windowless_test.h"
7 #include "webkit/glue/plugins/test/plugin_client.h" 7 #include "webkit/glue/plugins/test/plugin_client.h"
8 8
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include <ApplicationServices/ApplicationServices.h> 10 #include <ApplicationServices/ApplicationServices.h>
11 #include <Carbon/Carbon.h> 11 #include <Carbon/Carbon.h>
12 #endif 12 #endif
13 13
14 namespace NPAPIClient { 14 namespace NPAPIClient {
15 15
16 // Remember the first plugin instance for tests involving multiple instances 16 // Remember the first plugin instance for tests involving multiple instances
17 WindowlessPluginTest* g_other_instance = NULL; 17 WindowlessPluginTest* g_other_instance = NULL;
18 18
19 WindowlessPluginTest::WindowlessPluginTest( 19 WindowlessPluginTest::WindowlessPluginTest(NPP id,
20 NPP id, NPNetscapeFuncs *host_functions, const std::string& test_name) 20 NPNetscapeFuncs *host_functions)
21 : PluginTest(id, host_functions), 21 : PluginTest(id, host_functions) {
22 test_name_(test_name) {
23 if (!g_other_instance) 22 if (!g_other_instance)
24 g_other_instance = this; 23 g_other_instance = this;
25 } 24 }
26 25
27 static bool IsPaintEvent(NPEvent* np_event) { 26 static bool IsPaintEvent(NPEvent* np_event) {
28 #if defined(OS_WIN) 27 #if defined(OS_WIN)
29 return WM_PAINT == np_event->event; 28 return WM_PAINT == np_event->event;
30 #elif defined(OS_MACOSX) 29 #elif defined(OS_MACOSX)
31 return np_event->what == updateEvt; 30 return np_event->what == updateEvt;
32 #endif 31 #endif
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (!GetClipRgn(paint_dc, clipping_region)) { 83 if (!GetClipRgn(paint_dc, clipping_region)) {
85 SetError("No clipping region set in window DC"); 84 SetError("No clipping region set in window DC");
86 DeleteObject(clipping_region); 85 DeleteObject(clipping_region);
87 SignalTestCompleted(); 86 SignalTestCompleted();
88 return NPERR_GENERIC_ERROR; 87 return NPERR_GENERIC_ERROR;
89 } 88 }
90 89
91 DeleteObject(clipping_region); 90 DeleteObject(clipping_region);
92 #endif 91 #endif
93 92
94 if (test_name_ == "execute_script_delete_in_paint") { 93 if (test_name() == "execute_script_delete_in_paint") {
95 ExecuteScriptDeleteInPaint(browser); 94 ExecuteScriptDeleteInPaint(browser);
96 } else if (test_name_ == "multiple_instances_sync_calls") { 95 } else if (test_name() == "multiple_instances_sync_calls") {
97 MultipleInstanceSyncCalls(browser); 96 MultipleInstanceSyncCalls(browser);
98 } 97 }
99 #if OS_MACOSX 98 #if OS_MACOSX
100 } else if (IsWindowActivationEvent(np_event) && 99 } else if (IsWindowActivationEvent(np_event) &&
101 test_name_ == "convert_point") { 100 test_name() == "convert_point") {
102 ConvertPoint(browser); 101 ConvertPoint(browser);
103 #endif 102 #endif
104 } else if (IsMouseMoveEvent(np_event) && 103 } else if (IsMouseMoveEvent(np_event) &&
105 test_name_ == "execute_script_delete_in_mouse_move") { 104 test_name() == "execute_script_delete_in_mouse_move") {
106 ExecuteScript(browser, id(), "DeletePluginWithinScript();", NULL); 105 ExecuteScript(browser, id(), "DeletePluginWithinScript();", NULL);
107 SignalTestCompleted(); 106 SignalTestCompleted();
108 } else if (IsMouseUpEvent(np_event) && 107 } else if (IsMouseUpEvent(np_event) &&
109 test_name_ == "delete_frame_test") { 108 test_name() == "delete_frame_test") {
110 ExecuteScript( 109 ExecuteScript(
111 browser, id(), 110 browser, id(),
112 "parent.document.getElementById('frame').outerHTML = ''", NULL); 111 "parent.document.getElementById('frame').outerHTML = ''", NULL);
113 } 112 }
114 // If this test failed, then we'd have crashed by now. 113 // If this test failed, then we'd have crashed by now.
115 return PluginTest::HandleEvent(event); 114 return PluginTest::HandleEvent(event);
116 } 115 }
117 116
118 NPError WindowlessPluginTest::ExecuteScript(NPNetscapeFuncs* browser, NPP id, 117 NPError WindowlessPluginTest::ExecuteScript(NPNetscapeFuncs* browser, NPP id,
119 const std::string& script, NPVariant* result) { 118 const std::string& script, NPVariant* result) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 SetError("Window x location is wrong"); 216 SetError("Window x location is wrong");
218 else if (flipped_screen_y < 100 || flipped_screen_y > 300) 217 else if (flipped_screen_y < 100 || flipped_screen_y > 300)
219 SetError("Window y location is wrong"); 218 SetError("Window y location is wrong");
220 #else 219 #else
221 SetError("Unimplemented"); 220 SetError("Unimplemented");
222 #endif 221 #endif
223 SignalTestCompleted(); 222 SignalTestCompleted();
224 } 223 }
225 224
226 } // namespace NPAPIClient 225 } // namespace NPAPIClient
OLDNEW
« no previous file with comments | « webkit/glue/plugins/test/plugin_windowless_test.h ('k') | webkit/glue/plugins/test/resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698