| 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_test.h" | 5 #include "webkit/glue/plugins/test/plugin_test.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "webkit/glue/plugins/test/npapi_constants.h" | 8 #include "webkit/glue/plugins/test/npapi_constants.h" |
| 9 | 9 |
| 10 namespace NPAPIClient { | 10 namespace NPAPIClient { |
| 11 | 11 |
| 12 PluginTest::PluginTest(NPP id, NPNetscapeFuncs *host_functions) { | 12 PluginTest::PluginTest(NPP id, NPNetscapeFuncs *host_functions) { |
| 13 id_ = id; | 13 id_ = id; |
| 14 id_->pdata = this; | 14 id_->pdata = this; |
| 15 host_functions_ = host_functions; | 15 host_functions_ = host_functions; |
| 16 test_completed_ = false; |
| 16 } | 17 } |
| 17 | 18 |
| 18 NPError PluginTest::New(uint16 mode, int16 argc, const char* argn[], | 19 NPError PluginTest::New(uint16 mode, int16 argc, const char* argn[], |
| 19 const char* argv[], NPSavedData* saved) { | 20 const char* argv[], NPSavedData* saved) { |
| 20 test_name_ = this->GetArgValue("name", argc, argn, argv); | 21 test_name_ = this->GetArgValue("name", argc, argn, argv); |
| 21 test_id_ = this->GetArgValue("id", argc, argn, argv); | 22 test_id_ = this->GetArgValue("id", argc, argn, argv); |
| 22 return NPERR_NO_ERROR; | 23 return NPERR_NO_ERROR; |
| 23 } | 24 } |
| 24 | 25 |
| 25 NPError PluginTest::SetWindow(NPWindow* pNPWindow) { | 26 NPError PluginTest::SetWindow(NPWindow* pNPWindow) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 sOut.append(1, '%'); | 53 sOut.append(1, '%'); |
| 53 sOut.append(1, toHex(ch>>4)); | 54 sOut.append(1, toHex(ch>>4)); |
| 54 sOut.append(1, toHex(ch%16)); | 55 sOut.append(1, toHex(ch%16)); |
| 55 } | 56 } |
| 56 idx++; | 57 idx++; |
| 57 } | 58 } |
| 58 return sOut; | 59 return sOut; |
| 59 } | 60 } |
| 60 | 61 |
| 61 void PluginTest::SignalTestCompleted() { | 62 void PluginTest::SignalTestCompleted() { |
| 63 test_completed_ = true; |
| 62 // To signal test completion, we expect a couple of | 64 // To signal test completion, we expect a couple of |
| 63 // javascript functions to be defined in the webpage | 65 // javascript functions to be defined in the webpage |
| 64 // which hosts this plugin: | 66 // which hosts this plugin: |
| 65 // onSuccess(test_name, test_id) | 67 // onSuccess(test_name, test_id) |
| 66 // onFailure(test_name, test_id, error_message) | 68 // onFailure(test_name, test_id, error_message) |
| 67 std::string script_result; | 69 std::string script_result; |
| 68 std::string script_url; | 70 std::string script_url; |
| 69 if (Succeeded()) { | 71 if (Succeeded()) { |
| 70 script_url.append("onSuccess(\""); | 72 script_url.append("onSuccess(\""); |
| 71 script_url.append(test_name_); | 73 script_url.append(test_name_); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void PluginTest::URLNotify(const char* url, NPReason reason, void* data) { | 130 void PluginTest::URLNotify(const char* url, NPReason reason, void* data) { |
| 129 // There is no default action | 131 // There is no default action |
| 130 } | 132 } |
| 131 | 133 |
| 132 int16 PluginTest::HandleEvent(void* event) { | 134 int16 PluginTest::HandleEvent(void* event) { |
| 133 // There is no default action | 135 // There is no default action |
| 134 return 0; | 136 return 0; |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace NPAPIClient | 139 } // namespace NPAPIClient |
| OLD | NEW |