| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/test/plugin/plugin_javascript_open_popup.h" | 5 #include "content/test/plugin/plugin_javascript_open_popup.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 #if defined(USE_X11) | |
| 11 #include "third_party/npapi/bindings/npapi_x11.h" | |
| 12 #endif | |
| 13 #include "content/test/plugin/plugin_client.h" | 10 #include "content/test/plugin/plugin_client.h" |
| 14 | 11 |
| 15 namespace NPAPIClient { | 12 namespace NPAPIClient { |
| 16 | 13 |
| 17 ExecuteJavascriptOpenPopupWithPluginTest:: | 14 ExecuteJavascriptOpenPopupWithPluginTest:: |
| 18 ExecuteJavascriptOpenPopupWithPluginTest(NPP id, | 15 ExecuteJavascriptOpenPopupWithPluginTest(NPP id, |
| 19 NPNetscapeFuncs *host_functions) | 16 NPNetscapeFuncs *host_functions) |
| 20 : PluginTest(id, host_functions), | 17 : PluginTest(id, host_functions), |
| 21 popup_window_test_started_(false) { | 18 popup_window_test_started_(false) { |
| 22 } | 19 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (IsWindow(window_handle)) { | 65 if (IsWindow(window_handle)) { |
| 69 HWND parent_window = GetParent(window_handle); | 66 HWND parent_window = GetParent(window_handle); |
| 70 if (!IsWindow(parent_window)) | 67 if (!IsWindow(parent_window)) |
| 71 SetError("Windowed plugin instantiated with NULL parent"); | 68 SetError("Windowed plugin instantiated with NULL parent"); |
| 72 return true; | 69 return true; |
| 73 } | 70 } |
| 74 | 71 |
| 75 return false; | 72 return false; |
| 76 } | 73 } |
| 77 | 74 |
| 78 #elif defined(USE_X11) | |
| 79 // This code blindly follows the same sorts of verifications done on | |
| 80 // the Windows side. Does it make sense on X? Maybe not really, but | |
| 81 // it can't hurt to do extra validations. | |
| 82 bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow( | |
| 83 NPWindow* window) { | |
| 84 Window xwindow = reinterpret_cast<Window>(window->window); | |
| 85 // Grab a pointer to the extra SetWindow data so we can grab the display out. | |
| 86 NPSetWindowCallbackStruct* extra = | |
| 87 static_cast<NPSetWindowCallbackStruct*>(window->ws_info); | |
| 88 | |
| 89 if (xwindow) { | |
| 90 Window root, parent; | |
| 91 Window* wins = NULL; | |
| 92 unsigned int num_child; | |
| 93 Status status = XQueryTree(extra->display, xwindow, &root, &parent, | |
| 94 &wins, &num_child); | |
| 95 if (wins) | |
| 96 XFree(wins); | |
| 97 DCHECK(status != 0); | |
| 98 if (!parent || parent == root) | |
| 99 SetError("Windowed plugin instantiated with NULL parent"); | |
| 100 return true; | |
| 101 } | |
| 102 | |
| 103 return false; | |
| 104 } | |
| 105 #elif defined(OS_MACOSX) | 75 #elif defined(OS_MACOSX) |
| 106 bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow( | 76 bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow( |
| 107 NPWindow* window) { | 77 NPWindow* window) { |
| 108 // TODO(port) scaffolding--replace with a real test once NPWindow is done. | 78 // TODO(port) scaffolding--replace with a real test once NPWindow is done. |
| 109 return false; | 79 return false; |
| 110 } | 80 } |
| 111 #endif | 81 #endif |
| 112 | 82 |
| 113 } // namespace NPAPIClient | 83 } // namespace NPAPIClient |
| OLD | NEW |