Chromium Code Reviews| Index: ppapi/tests/test_input_event.cc |
| =================================================================== |
| --- ppapi/tests/test_input_event.cc (revision 114869) |
| +++ ppapi/tests/test_input_event.cc (working copy) |
| @@ -47,13 +47,12 @@ |
| TestInputEvent::~TestInputEvent() { |
| // Remove the special listener that only responds to a |
| // FINISHED_WAITING_MESSAGE string. See Init for where it gets added. |
| - std::string js_code; |
| + std::string js_code("TESTING_MESSAGE:ExecuteScript:"); |
|
dmichael (off chromium)
2011/12/16 22:38:56
Could you instead add an "ExecuteScript" convenien
bbudge
2011/12/16 23:24:06
Good idea. Done.
On 2011/12/16 22:38:56, dmichael
|
| js_code += "var plugin = document.getElementById('plugin');" |
| "plugin.removeEventListener('message'," |
| " plugin.wait_for_messages_handler);" |
| "delete plugin.wait_for_messages_handler;"; |
| - pp::Var exception; |
| - instance_->ExecuteScript(js_code, &exception); |
| + instance_->PostMessage(pp::Var(js_code)); |
| } |
| bool TestInputEvent::Init() { |
| @@ -78,7 +77,7 @@ |
| // Set up a listener for our message that signals that all input events have |
| // been received. |
| - std::string js_code; |
| + std::string js_code("TESTING_MESSAGE:ExecuteScript:"); |
| // Note the following code is dependent on some features of test_case.html. |
| // E.g., it is assumed that the DOM element where the plugin is embedded has |
| // an id of 'plugin', and there is a function 'IsTestingMessage' that allows |
| @@ -94,9 +93,7 @@ |
| "plugin.addEventListener('message', wait_for_messages_handler);" |
| // Stash it on the plugin so we can remove it in the destructor. |
| "plugin.wait_for_messages_handler = wait_for_messages_handler;"; |
| - pp::Var exception; |
| - instance_->ExecuteScript(js_code, &exception); |
| - success = success && exception.is_undefined(); |
| + instance_->PostMessage(pp::Var(js_code)); |
| return success; |
| } |