OLD | NEW |
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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" | 6 #include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" |
7 | 7 |
8 #if defined(USE_X11) | 8 #if defined(USE_X11) |
9 #include "third_party/npapi/bindings/npapi_x11.h" | 9 #include "third_party/npapi/bindings/npapi_x11.h" |
10 #endif | 10 #endif |
11 #include "webkit/glue/plugins/test/plugin_client.h" | 11 #include "webkit/glue/plugins/test/plugin_client.h" |
12 | 12 |
13 namespace NPAPIClient { | 13 namespace NPAPIClient { |
14 | 14 |
15 ExecuteJavascriptOpenPopupWithPluginTest:: | 15 ExecuteJavascriptOpenPopupWithPluginTest:: |
16 ExecuteJavascriptOpenPopupWithPluginTest(NPP id, | 16 ExecuteJavascriptOpenPopupWithPluginTest(NPP id, |
17 NPNetscapeFuncs *host_functions) | 17 NPNetscapeFuncs *host_functions) |
18 : PluginTest(id, host_functions), | 18 : PluginTest(id, host_functions), |
19 popup_window_test_started_(false) { | 19 popup_window_test_started_(false) { |
20 } | 20 } |
21 | 21 |
22 int16 ExecuteJavascriptOpenPopupWithPluginTest::SetWindow( | 22 int16 ExecuteJavascriptOpenPopupWithPluginTest::SetWindow( |
23 NPWindow* window) { | 23 NPWindow* window) { |
| 24 if (window->window == NULL) |
| 25 return NPERR_NO_ERROR; |
| 26 |
24 if (!popup_window_test_started_) { | 27 if (!popup_window_test_started_) { |
25 popup_window_test_started_ = true; | 28 popup_window_test_started_ = true; |
26 HostFunctions()->geturl( | 29 HostFunctions()->geturl( |
27 id(), "popup_window_with_target_plugin.html", "_blank"); | 30 id(), "popup_window_with_target_plugin.html", "_blank"); |
28 } | 31 } |
29 return PluginTest::SetWindow(window); | 32 return NPERR_NO_ERROR; |
30 } | 33 } |
31 | 34 |
32 // ExecuteJavascriptPopupWindowTargetPluginTest member defines. | 35 // ExecuteJavascriptPopupWindowTargetPluginTest member defines. |
33 ExecuteJavascriptPopupWindowTargetPluginTest:: | 36 ExecuteJavascriptPopupWindowTargetPluginTest:: |
34 ExecuteJavascriptPopupWindowTargetPluginTest( | 37 ExecuteJavascriptPopupWindowTargetPluginTest( |
35 NPP id, NPNetscapeFuncs* host_functions) | 38 NPP id, NPNetscapeFuncs* host_functions) |
36 : PluginTest(id, host_functions), | 39 : PluginTest(id, host_functions), |
37 test_completed_(false) { | 40 test_completed_(false) { |
38 } | 41 } |
39 | 42 |
40 int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow( | 43 int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow( |
41 NPWindow* window) { | 44 NPWindow* window) { |
| 45 if (window->window == NULL) |
| 46 return NPERR_NO_ERROR; |
| 47 |
42 if (!test_completed_) { | 48 if (!test_completed_) { |
43 if (CheckWindow(window)) { | 49 if (CheckWindow(window)) { |
44 SignalTestCompleted(); | 50 SignalTestCompleted(); |
45 test_completed_ = true; | 51 test_completed_ = true; |
46 } | 52 } |
47 } | 53 } |
48 return PluginTest::SetWindow(window); | 54 return PluginTest::SetWindow(window); |
49 } | 55 } |
50 | 56 |
51 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 94 } |
89 #elif defined(OS_MACOSX) | 95 #elif defined(OS_MACOSX) |
90 bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow( | 96 bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow( |
91 NPWindow* window) { | 97 NPWindow* window) { |
92 // TODO(port) scaffolding--replace with a real test once NPWindow is done. | 98 // TODO(port) scaffolding--replace with a real test once NPWindow is done. |
93 return false; | 99 return false; |
94 } | 100 } |
95 #endif | 101 #endif |
96 | 102 |
97 } // namespace NPAPIClient | 103 } // namespace NPAPIClient |
OLD | NEW |