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

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

Issue 601923003: Revert of PPAPI: Never re-enter JavaScript for PostMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 js_code += "result = plugin.postMessageAndAwaitResponse("; 245 js_code += "result = plugin.postMessageAndAwaitResponse(";
246 js_code += values_to_test[i]; 246 js_code += values_to_test[i];
247 js_code += ");\n"; 247 js_code += ");\n";
248 js_code += "if (!deepCompare(result, "; 248 js_code += "if (!deepCompare(result, ";
249 js_code += values_to_test[i]; 249 js_code += values_to_test[i];
250 js_code += "))\n"; 250 js_code += "))\n";
251 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: "; 251 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: ";
252 js_code += values_to_test[i]; 252 js_code += values_to_test[i];
253 js_code += " result: \" + result);\n"; 253 js_code += " result: \" + result);\n";
254 } 254 }
255 // TODO(dmichael): Setting a property uses GetInstanceObject, which sends sync
256 // message, which can get interrupted with message to eval script, etc.
257 // FINISHED_WAITING message can therefore jump ahead. This test is
258 // currently carefully crafted to avoid races by doing all the JS in one call.
259 // That should be fixed before this API goes to stable. See crbug.com/384528
260 js_code += "plugin.postMessage('FINISHED_TEST');\n";
255 instance_->EvalScript(js_code); 261 instance_->EvalScript(js_code);
256 instance_->EvalScript("plugin.postMessage('FINISHED_TEST');\n");
257 handler.WaitForTestFinishedMessage(); 262 handler.WaitForTestFinishedMessage();
258 handler.Unregister(); 263 handler.Unregister();
259 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy()); 264 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy());
260 265
261 PASS(); 266 PASS();
262 } 267 }
263 268
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