Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: ppapi/tests/test_post_message.cc

Issue 8920005: Add TestingInstance::EvalScript method which posts a message that the test page can eval(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_input_event.cc ('k') | ppapi/tests/testing_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_post_message.cc
===================================================================
--- ppapi/tests/test_post_message.cc (revision 114869)
+++ ppapi/tests/test_post_message.cc (working copy)
@@ -65,8 +65,7 @@
"plugin.removeEventListener('message',"
" plugin.wait_for_messages_handler);"
"delete plugin.wait_for_messages_handler;";
- pp::Var exception;
- instance_->ExecuteScript(js_code, &exception);
+ instance_->EvalScript(js_code);
}
bool TestPostMessage::Init() {
@@ -90,9 +89,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_->EvalScript(js_code);
// Set up the JavaScript message event listener to echo the data part of the
// message event back to us.
@@ -149,20 +146,19 @@
// ClearListeners()).
"if (!plugin.eventListeners) plugin.eventListeners = [];"
"plugin.eventListeners.push(message_handler);";
- pp::Var exception;
- instance_->ExecuteScript(js_code, &exception);
- return exception.is_undefined();
+ instance_->EvalScript(js_code);
+ return true;
}
bool TestPostMessage::ClearListeners() {
- std::string js_code(
- "var plugin = document.getElementById('plugin');"
- "while (plugin.eventListeners.length) {"
- " plugin.removeEventListener('message', plugin.eventListeners.pop());"
- "}");
- pp::Var exception;
- instance_->ExecuteScript(js_code, &exception);
- return(exception.is_undefined());
+ std::string js_code;
+ js_code += "var plugin = document.getElementById('plugin');"
+ "while (plugin.eventListeners.length) {"
+ " plugin.removeEventListener('message',"
+ " plugin.eventListeners.pop());"
+ "}";
+ instance_->EvalScript(js_code);
+ return true;
}
int TestPostMessage::WaitForMessages() {
« no previous file with comments | « ppapi/tests/test_input_event.cc ('k') | ppapi/tests/testing_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698