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

Unified Diff: ppapi/tests/test_message_handler.cc

Issue 1440423003: Add support for HandleBlockingMessage to NaClMessageScanner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge with mseaborn's changes Created 4 years, 11 months 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_message_handler.h ('k') | ppapi/tests/test_post_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_message_handler.cc
diff --git a/ppapi/tests/test_message_handler.cc b/ppapi/tests/test_message_handler.cc
index 6fa1c13a748b45dd2793e9cd841f180e4b86a817..a9bcccb96ec674bcdb91ceb954cecb7421df3c38 100644
--- a/ppapi/tests/test_message_handler.cc
+++ b/ppapi/tests/test_message_handler.cc
@@ -221,6 +221,7 @@ bool TestMessageHandler::Init() {
void TestMessageHandler::RunTests(const std::string& filter) {
RUN_TEST(RegisterErrorConditions, filter);
RUN_TEST(PostMessageAndAwaitResponse, filter);
+ RUN_TEST(ArrayBuffer, filter);
RUN_TEST(Exceptions, filter);
}
@@ -304,6 +305,40 @@ std::string TestMessageHandler::TestPostMessageAndAwaitResponse() {
PASS();
}
+std::string TestMessageHandler::TestArrayBuffer() {
+ // Set the array buffer shared memory threshold so that some of the
+ // ArrayBuffer values will be sent as shared memory.
+ ScopedArrayBufferSizeSetter setter(testing_interface_,
+ instance_->pp_instance(),
+ 200);
+ const char* const sizes[] = { "0", "128", "1024", "4096", NULL };
+ MyMessageHandler handler(instance(),
+ handler_thread_.message_loop());
+ handler.Register();
+ std::string js_code("var plugin = document.getElementById('plugin');\n");
+ js_code += "var result = undefined;\n";
+ js_code += "var param = undefined;\n";
+ for (size_t i = 0; sizes[i]; ++i) {
+ js_code += "param = new ArrayBuffer(";
+ js_code += sizes[i];
+ js_code += ");";
+ // TODO(dmichael): It would be better to set specific values in param.
+ js_code += "result = plugin.postMessageAndAwaitResponse(param);";
+ js_code += "if (!deepCompare(result, param))\n";
+ js_code += " InternalError(\" Failed postMessageAndAwaitResponse for ";
+ js_code += "ArrayBuffer of size: ";
+ js_code += sizes[i];
+ js_code += " result: \" + result);\n";
+ }
+ instance_->EvalScript(js_code);
+ instance_->EvalScript("plugin.postMessage('FINISHED_TEST');\n");
+ handler.WaitForTestFinishedMessage();
+ handler.Unregister();
+ ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy());
+
+ PASS();
+}
+
std::string TestMessageHandler::TestExceptions() {
MyMessageHandler handler(instance(),
handler_thread_.message_loop());
« no previous file with comments | « ppapi/tests/test_message_handler.h ('k') | ppapi/tests/test_post_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698