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

Side by Side Diff: ppapi/tests/test_message_handler.cc

Issue 589213003: PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make MessageChannel observer clean up more reliably, guarantee HungPluginFilter stays alive long en… Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ppapi/tests/test_message_handler.h" 5 #include "ppapi/tests/test_message_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <sstream> 10 #include <sstream>
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 js_code += "result = plugin.postMessageAndAwaitResponse("; 272 js_code += "result = plugin.postMessageAndAwaitResponse(";
273 js_code += values_to_test[i]; 273 js_code += values_to_test[i];
274 js_code += ");\n"; 274 js_code += ");\n";
275 js_code += "if (!deepCompare(result, "; 275 js_code += "if (!deepCompare(result, ";
276 js_code += values_to_test[i]; 276 js_code += values_to_test[i];
277 js_code += "))\n"; 277 js_code += "))\n";
278 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: "; 278 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: ";
279 js_code += values_to_test[i]; 279 js_code += values_to_test[i];
280 js_code += " result: \" + result);\n"; 280 js_code += " result: \" + result);\n";
281 } 281 }
282 // TODO(dmichael): Setting a property uses GetInstanceObject, which sends sync
283 // message, which can get interrupted with message to eval script, etc.
284 // FINISHED_WAITING message can therefore jump ahead. This test is
285 // currently carefully crafted to avoid races by doing all the JS in one call.
286 // That should be fixed before this API goes to stable. See crbug.com/384528
287 js_code += "plugin.postMessage('FINISHED_TEST');\n";
288 instance_->EvalScript(js_code); 282 instance_->EvalScript(js_code);
283 instance_->EvalScript("plugin.postMessage('FINISHED_TEST');\n");
289 handler.WaitForTestFinishedMessage(); 284 handler.WaitForTestFinishedMessage();
290 handler.Unregister(); 285 handler.Unregister();
291 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy()); 286 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy());
292 287
293 PASS(); 288 PASS();
294 } 289 }
295 290
296 std::string TestMessageHandler::TestExceptions() { 291 std::string TestMessageHandler::TestExceptions() {
297 EchoingMessageHandler handler(instance(), 292 EchoingMessageHandler handler(instance(),
298 handler_thread_.message_loop()); 293 handler_thread_.message_loop());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 instance_->EvalScript(js_code); 334 instance_->EvalScript(js_code);
340 message_received_.Wait(); 335 message_received_.Wait();
341 ASSERT_EQ("SUCCESS", last_message_); 336 ASSERT_EQ("SUCCESS", last_message_);
342 } 337 }
343 handler.Unregister(); 338 handler.Unregister();
344 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy()); 339 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy());
345 340
346 PASS(); 341 PASS();
347 } 342 }
348 343
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698