OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_url2_test.h" | 5 #include "webkit/glue/plugins/test/plugin_get_javascript_url2_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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace NPAPIClient { | 23 namespace NPAPIClient { |
24 | 24 |
25 ExecuteGetJavascriptUrl2Test::ExecuteGetJavascriptUrl2Test( | 25 ExecuteGetJavascriptUrl2Test::ExecuteGetJavascriptUrl2Test( |
26 NPP id, NPNetscapeFuncs *host_functions) | 26 NPP id, NPNetscapeFuncs *host_functions) |
27 : PluginTest(id, host_functions), | 27 : PluginTest(id, host_functions), |
28 test_started_(false) { | 28 test_started_(false) { |
29 } | 29 } |
30 | 30 |
31 NPError ExecuteGetJavascriptUrl2Test::SetWindow(NPWindow* pNPWindow) { | 31 NPError ExecuteGetJavascriptUrl2Test::SetWindow(NPWindow* pNPWindow) { |
| 32 if (pNPWindow->window == NULL) |
| 33 return NPERR_NO_ERROR; |
| 34 |
32 if (!test_started_) { | 35 if (!test_started_) { |
33 std::string url = SELF_URL; | 36 std::string url = SELF_URL; |
34 HostFunctions()->geturlnotify(id(), url.c_str(), "_self", | 37 HostFunctions()->geturlnotify(id(), url.c_str(), "_self", |
35 reinterpret_cast<void*>(SELF_URL_STREAM_ID)); | 38 reinterpret_cast<void*>(SELF_URL_STREAM_ID)); |
36 test_started_ = true; | 39 test_started_ = true; |
37 } | 40 } |
38 return NPERR_NO_ERROR; | 41 return NPERR_NO_ERROR; |
39 } | 42 } |
40 | 43 |
41 NPError ExecuteGetJavascriptUrl2Test::NewStream(NPMIMEType type, NPStream* strea
m, | 44 NPError ExecuteGetJavascriptUrl2Test::NewStream(NPMIMEType type, NPStream* strea
m, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 SetError("Failed to obtain window location."); | 125 SetError("Failed to obtain window location."); |
123 SignalTestCompleted(); | 126 SignalTestCompleted(); |
124 break; | 127 break; |
125 default: | 128 default: |
126 SetError("Unexpected NewStream callback"); | 129 SetError("Unexpected NewStream callback"); |
127 break; | 130 break; |
128 } | 131 } |
129 } | 132 } |
130 | 133 |
131 } // namespace NPAPIClient | 134 } // namespace NPAPIClient |
OLD | NEW |