diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-01 19:19:48 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-01 19:19:48 +0000 |
commit | 2f93bcc8883a14ad50f51ccb0d127cf10f2c0bf4 (patch) | |
tree | 6e92d4d42fca319a1eca058b0470fd3ac7f451ad /ppapi/tests/test_utils.h | |
parent | 92d4578023a8102054295c0de59b075d3fc28290 (diff) | |
download | chromium_src-2f93bcc8883a14ad50f51ccb0d127cf10f2c0bf4.zip chromium_src-2f93bcc8883a14ad50f51ccb0d127cf10f2c0bf4.tar.gz chromium_src-2f93bcc8883a14ad50f51ccb0d127cf10f2c0bf4.tar.bz2 |
PPAPI: TestCompletionCallbackWithOutput fixes
Make TestCompletionCallbackWithOutput work for POD types and blocking callbacks.
As a bonus, make CHECK_CALLBACK_BEHAVIOR put FILE and LINE info in its error message.
This is split out from teravest@'s FileRef::Query CL:
https://codereview.chromium.org/12817009/
Since a few other people have run in to the problem.
BUG=224741
R=teravest
TBR=bbudge@chromium.org
Review URL: https://chromiumcodereview.appspot.com/13296006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191633 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_utils.h')
-rw-r--r-- | ppapi/tests/test_utils.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h index 0018d61..d82b5ef 100644 --- a/ppapi/tests/test_utils.h +++ b/ppapi/tests/test_utils.h @@ -189,7 +189,10 @@ class TestCompletionCallbackWithOutput { } pp::CompletionCallbackWithOutput<OutputT> GetCallback(); - const OutputT& output() { return output_storage_.output(); } + OutputT output() { + return pp::internal::CallbackOutputTraits<OutputT>::StorageToPluginArg( + output_storage_); + } // Delegate functions to TestCompletionCallback void SetDelegate(TestCompletionCallback::Delegate* delegate) { @@ -221,10 +224,7 @@ pp::CompletionCallbackWithOutput<OutputT> TestCompletionCallbackWithOutput<OutputT>::GetCallback() { callback_.Reset(); if (callback_.callback_type() == PP_BLOCKING) { - pp::CompletionCallbackWithOutput<OutputT> cc( - &TestCompletionCallback::Handler, - this, - &output_storage_); + pp::CompletionCallbackWithOutput<OutputT> cc(&output_storage_); return cc; } @@ -245,7 +245,8 @@ TestCompletionCallbackWithOutput<OutputT>::GetCallback() { #define CHECK_CALLBACK_BEHAVIOR(callback) \ do { \ if ((callback).failed()) \ - return (callback).errors(); \ + return MakeFailureMessage(__FILE__, __LINE__, \ + (callback).errors().c_str()); \ } while (false) /* |