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 "webkit/glue/plugins/test/plugin_get_javascript_url_test.h" | 5 #include "webkit/glue/plugins/test/plugin_get_javascript_url_test.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 | 8 |
9 // url for "self". | 9 // url for "self". |
10 #define SELF_URL "javascript:window.location+\"\"" | 10 #define SELF_URL "javascript:window.location+\"\"" |
(...skipping 15 matching lines...) Expand all Loading... |
26 ExecuteGetJavascriptUrlTest::ExecuteGetJavascriptUrlTest(NPP id, NPNetscapeFuncs
*host_functions) | 26 ExecuteGetJavascriptUrlTest::ExecuteGetJavascriptUrlTest(NPP id, NPNetscapeFuncs
*host_functions) |
27 : PluginTest(id, host_functions), | 27 : PluginTest(id, host_functions), |
28 test_started_(false), | 28 test_started_(false), |
29 #ifdef OS_WIN | 29 #ifdef OS_WIN |
30 window_(NULL), | 30 window_(NULL), |
31 #endif | 31 #endif |
32 npn_evaluate_context_(false) { | 32 npn_evaluate_context_(false) { |
33 } | 33 } |
34 | 34 |
35 NPError ExecuteGetJavascriptUrlTest::SetWindow(NPWindow* pNPWindow) { | 35 NPError ExecuteGetJavascriptUrlTest::SetWindow(NPWindow* pNPWindow) { |
| 36 if (pNPWindow->window == NULL) |
| 37 return NPERR_NO_ERROR; |
| 38 |
36 if (!test_started_) { | 39 if (!test_started_) { |
37 std::string url = SELF_URL; | 40 std::string url = SELF_URL; |
38 HostFunctions()->geturlnotify(id(), url.c_str(), "_top", | 41 HostFunctions()->geturlnotify(id(), url.c_str(), "_top", |
39 reinterpret_cast<void*>(SELF_URL_STREAM_ID)); | 42 reinterpret_cast<void*>(SELF_URL_STREAM_ID)); |
40 test_started_ = true; | 43 test_started_ = true; |
41 | 44 |
42 #ifdef OS_WIN | 45 #ifdef OS_WIN |
43 HWND window_handle = reinterpret_cast<HWND>(pNPWindow->window); | 46 HWND window_handle = reinterpret_cast<HWND>(pNPWindow->window); |
44 if (!::GetProp(window_handle, L"Plugin_Instance")) { | 47 if (!::GetProp(window_handle, L"Plugin_Instance")) { |
45 ::SetProp(window_handle, L"Plugin_Instance", this); | 48 ::SetProp(window_handle, L"Plugin_Instance", this); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 SetError("Failed to obtain window location."); | 201 SetError("Failed to obtain window location."); |
199 SignalTestCompleted(); | 202 SignalTestCompleted(); |
200 break; | 203 break; |
201 default: | 204 default: |
202 SetError("Unexpected NewStream callback"); | 205 SetError("Unexpected NewStream callback"); |
203 break; | 206 break; |
204 } | 207 } |
205 } | 208 } |
206 | 209 |
207 } // namespace NPAPIClient | 210 } // namespace NPAPIClient |
OLD | NEW |