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

Unified Diff: ppapi/tests/test_utils.h

Issue 10661026: WebSocket Pepper API: allow to release in completion callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remvoe redundant checker Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/tests/test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_utils.h
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h
index 1e2ec369316475accbd41d986e2a22f40d0d1bb0..4168cec9478db950dbce96d17fb7fa9ac4b0f517 100644
--- a/ppapi/tests/test_utils.h
+++ b/ppapi/tests/test_utils.h
@@ -62,12 +62,22 @@ class NestedEvent {
enum CallbackType { PP_REQUIRED, PP_OPTIONAL, PP_BLOCKING };
class TestCompletionCallback {
public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual void OnCallback(void* user_data, int32_t result) = 0;
+ };
explicit TestCompletionCallback(PP_Instance instance);
// TODO(dmichael): Remove this constructor.
TestCompletionCallback(PP_Instance instance, bool force_async);
TestCompletionCallback(PP_Instance instance, CallbackType callback_type);
+ // Sets a Delegate instance. OnCallback() of this instance will be invoked
+ // when the completion callback is invoked.
+ // The delegate will be reset when Reset() or GetCallback() is called.
+ void SetDelegate(Delegate* delegate) { delegate_ = delegate; }
+
// Waits for the callback to be called and returns the
// result. Returns immediately if the callback was previously called
// and the result wasn't returned (i.e. each result value received
@@ -153,6 +163,7 @@ class TestCompletionCallback {
std::string errors_;
unsigned run_count_;
PP_Instance instance_;
+ Delegate* delegate_;
};
// Verifies that the callback didn't record any errors. If the callback is run
« no previous file with comments | « no previous file | ppapi/tests/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698