summaryrefslogtreecommitdiffstats
path: root/net/base/test_completion_callback.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/test_completion_callback.h')
-rw-r--r--net/base/test_completion_callback.h42
1 files changed, 18 insertions, 24 deletions
diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h
index 888c610..a192194 100644
--- a/net/base/test_completion_callback.h
+++ b/net/base/test_completion_callback.h
@@ -22,51 +22,45 @@
// there could be other side-effects resulting from WaitForResult. For this
// reason, this class is probably not ideal for a general application.
//
-
-// Base class overridden by custom implementations of TestCompletionCallback.
-class TestCompletionCallbackBase {
+class TestOldCompletionCallback : public CallbackRunner< Tuple1<int> > {
public:
- void SetResult(int result);
+ TestOldCompletionCallback();
+ virtual ~TestOldCompletionCallback();
+
int WaitForResult();
+
int GetResult(int result);
+
bool have_result() const { return have_result_; }
- protected:
- TestCompletionCallbackBase();
+ virtual void RunWithParams(const Tuple1<int>& params) OVERRIDE;
+ private:
int result_;
bool have_result_;
bool waiting_for_result_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestCompletionCallbackBase);
-};
-
-class TestOldCompletionCallback : public TestCompletionCallbackBase,
- public CallbackRunner< Tuple1<int> > {
- public:
- TestOldCompletionCallback() {};
- virtual ~TestOldCompletionCallback() {}
-
- virtual void RunWithParams(const Tuple1<int>& params) OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestOldCompletionCallback);
};
namespace net {
-class TestCompletionCallback : public TestCompletionCallbackBase {
+class TestCompletionCallback {
public:
TestCompletionCallback();
~TestCompletionCallback();
+ int WaitForResult() { return old_callback_impl_.WaitForResult(); }
+
+ int GetResult(int result) { return old_callback_impl_.GetResult(result); }
+
+ bool have_result() const { return old_callback_impl_.have_result(); }
+
const CompletionCallback& callback() const { return callback_; }
private:
- const CompletionCallback callback_;
+ void OnComplete(int result);
- DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback);
+ const CompletionCallback callback_;
+ TestOldCompletionCallback old_callback_impl_;
};
} // namespace net