Chromium Code Reviews| Index: ppapi/tests/test_utils.cc |
| diff --git a/ppapi/tests/test_utils.cc b/ppapi/tests/test_utils.cc |
| index 7405e93da34182a24e713ce9b13a827e2abe21d2..514e47f3d4545670e68119b22c8092bcd1572493 100644 |
| --- a/ppapi/tests/test_utils.cc |
| +++ b/ppapi/tests/test_utils.cc |
| @@ -97,6 +97,7 @@ TestCompletionCallback::TestCompletionCallback(PP_Instance instance) |
| // what the tests currently expect. |
| callback_type_(PP_OPTIONAL), |
| post_quit_task_(false), |
| + run_count_(0), // TODO(dmichael): Remove when all tests are updated. |
| instance_(instance) { |
|
dmichael (off chromium)
2012/04/19 20:02:00
I had erroneously gotten rid of the implementation
|
| } |
| @@ -172,9 +173,9 @@ void TestCompletionCallback::WaitForAbortResult(int32_t result) { |
| final_result)); |
| return; |
| } |
| - } else if (result != PP_OK) { |
| + } else if (result < PP_OK) { |
| errors_.assign( |
| - ReportError("TestCompletionCallback: Expected PP_ERROR_ABORTED or" |
| + ReportError("TestCompletionCallback: Expected PP_ERROR_ABORTED or " |
| "PP_OK. Ran synchronously.", |
| result)); |
| return; |
| @@ -198,6 +199,7 @@ void TestCompletionCallback::Reset() { |
| result_ = PP_OK_COMPLETIONPENDING; |
| have_result_ = false; |
| post_quit_task_ = false; |
| + run_count_ = 0; // TODO(dmichael): Remove when all tests are updated. |
| errors_.clear(); |
| } |
| @@ -205,9 +207,12 @@ void TestCompletionCallback::Reset() { |
| void TestCompletionCallback::Handler(void* user_data, int32_t result) { |
| TestCompletionCallback* callback = |
| static_cast<TestCompletionCallback*>(user_data); |
| + // If this check fails, it means that the callback was invoked twice or that |
| + // the PPAPI call completed synchronously, but also ran the callback. |
| PP_DCHECK(!callback->have_result_); |
| callback->result_ = result; |
| callback->have_result_ = true; |
| + callback->run_count_++; // TODO(dmichael): Remove when all tests are updated. |
| if (callback->post_quit_task_) { |
| callback->post_quit_task_ = false; |
| GetTestingInterface()->QuitMessageLoop(callback->instance_); |