| OLD | NEW |
| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 js_code += "result = plugin.postMessageAndAwaitResponse("; | 259 js_code += "result = plugin.postMessageAndAwaitResponse("; |
| 260 js_code += values_to_test[i]; | 260 js_code += values_to_test[i]; |
| 261 js_code += ");\n"; | 261 js_code += ");\n"; |
| 262 js_code += "if (!deepCompare(result, "; | 262 js_code += "if (!deepCompare(result, "; |
| 263 js_code += values_to_test[i]; | 263 js_code += values_to_test[i]; |
| 264 js_code += "))\n"; | 264 js_code += "))\n"; |
| 265 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: "; | 265 js_code += " InternalError(\" Failed postMessageAndAwaitResponse for: "; |
| 266 js_code += values_to_test[i]; | 266 js_code += values_to_test[i]; |
| 267 js_code += " result: \" + result);\n"; | 267 js_code += " result: \" + result);\n"; |
| 268 } | 268 } |
| 269 // TODO(dmichael): Setting a property uses GetInstanceObject, which sends sync |
| 270 // message, which can get interrupted with message to eval script, etc. |
| 271 // FINISHED_WAITING message can therefore jump ahead. This test is |
| 272 // currently carefully crafted to avoid races by doing all the JS in one call. |
| 273 // That should be fixed before this API goes to stable. See crbug.com/384528 |
| 274 js_code += "plugin.postMessage('FINISHED_TEST');\n"; |
| 269 instance_->EvalScript(js_code); | 275 instance_->EvalScript(js_code); |
| 270 instance_->EvalScript("plugin.postMessage('FINISHED_TEST');\n"); | |
| 271 handler.WaitForTestFinishedMessage(); | 276 handler.WaitForTestFinishedMessage(); |
| 272 handler.Unregister(); | 277 handler.Unregister(); |
| 273 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy()); | 278 ASSERT_SUBTEST_SUCCESS(handler.WaitForDestroy()); |
| 274 | 279 |
| 275 PASS(); | 280 PASS(); |
| 276 } | 281 } |
| 277 | 282 |
| OLD | NEW |