| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
| 7 #include "content/test/plugin/plugin_windowless_test.h" | 7 #include "content/test/plugin/plugin_windowless_test.h" |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "content/test/plugin/plugin_client.h" | 11 #include "content/test/plugin/plugin_client.h" |
| 12 | 12 |
| 13 #if defined(TOOLKIT_GTK) | |
| 14 #include <gdk/gdkx.h> | |
| 15 #endif | |
| 16 | |
| 17 // NPEvent does not exist on the Mac. | 13 // NPEvent does not exist on the Mac. |
| 18 #if defined(OS_MACOSX) | 14 #if defined(OS_MACOSX) |
| 19 typedef NPCocoaEvent WindowlessPluginTestEvent; | 15 typedef NPCocoaEvent WindowlessPluginTestEvent; |
| 20 #else | 16 #else |
| 21 typedef NPEvent WindowlessPluginTestEvent; | 17 typedef NPEvent WindowlessPluginTestEvent; |
| 22 #endif | 18 #endif |
| 23 | 19 |
| 24 namespace NPAPIClient { | 20 namespace NPAPIClient { |
| 25 | 21 |
| 26 namespace { | 22 namespace { |
| 27 | 23 |
| 28 // Remember the first plugin instance for tests involving multiple instances. | 24 // Remember the first plugin instance for tests involving multiple instances. |
| 29 WindowlessPluginTest* g_other_instance = NULL; | 25 WindowlessPluginTest* g_other_instance = NULL; |
| 30 | 26 |
| 31 void OnFinishTest(void* data) { | 27 void OnFinishTest(void* data) { |
| 32 static_cast<WindowlessPluginTest*>(data)->SignalTestCompleted(); | 28 static_cast<WindowlessPluginTest*>(data)->SignalTestCompleted(); |
| 33 } | 29 } |
| 34 | 30 |
| 35 bool IsPaintEvent(WindowlessPluginTestEvent* np_event) { | 31 bool IsPaintEvent(WindowlessPluginTestEvent* np_event) { |
| 36 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 37 return np_event->event == WM_PAINT; | 33 return np_event->event == WM_PAINT; |
| 38 #elif defined(OS_MACOSX) | 34 #elif defined(OS_MACOSX) |
| 39 return np_event->type == NPCocoaEventDrawRect; | 35 return np_event->type == NPCocoaEventDrawRect; |
| 40 #elif defined(TOOLKIT_GTK) | |
| 41 return np_event->type == GraphicsExpose; | |
| 42 #else | 36 #else |
| 43 NOTIMPLEMENTED(); | 37 NOTIMPLEMENTED(); |
| 44 return false; | 38 return false; |
| 45 #endif | 39 #endif |
| 46 } | 40 } |
| 47 | 41 |
| 48 bool IsMouseUpEvent(WindowlessPluginTestEvent* np_event) { | 42 bool IsMouseUpEvent(WindowlessPluginTestEvent* np_event) { |
| 49 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 50 return np_event->event == WM_LBUTTONUP; | 44 return np_event->event == WM_LBUTTONUP; |
| 51 #elif defined(OS_MACOSX) | 45 #elif defined(OS_MACOSX) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 error_string.append(StringForPoint(flipped_window_x, flipped_window_y)); | 306 error_string.append(StringForPoint(flipped_window_x, flipped_window_y)); |
| 313 SetError(error_string); | 307 SetError(error_string); |
| 314 } | 308 } |
| 315 #else | 309 #else |
| 316 SetError("Unimplemented"); | 310 SetError("Unimplemented"); |
| 317 #endif | 311 #endif |
| 318 SignalTestCompleted(); | 312 SignalTestCompleted(); |
| 319 } | 313 } |
| 320 | 314 |
| 321 } // namespace NPAPIClient | 315 } // namespace NPAPIClient |
| OLD | NEW |