Use CompletionOnceCallback in test helper classes.
Change return value callback method from CompletionCallback to
CompletionOnceCallback in all TestCompletionCallbackBase derived classes
except for TestCompletionCallback, and use BindOnce instead of Bind.
Remove CompletionCallback private members and bind at method call time
instead of construction time.
Bug: 807724
Change-Id: I2931d7a0ff5086a8733b8a27a7940d90f95ae683
Reviewed-on: https://chromium-review.googlesource.com/1097200
Reviewed-by: Zhongyi Shi <[email protected]>
Commit-Queue: Bence Béky <[email protected]>
Cr-Commit-Position: refs/heads/master@{#566667}
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index c1278fe..b244bbf 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -105,12 +105,12 @@
class CancelStreamCallback : public TestCompletionCallbackBase {
public:
- explicit CancelStreamCallback(SpdyHttpStream* stream)
- : stream_(stream),
- callback_(base::Bind(&CancelStreamCallback::CancelStream,
- base::Unretained(this))) {}
+ explicit CancelStreamCallback(SpdyHttpStream* stream) : stream_(stream) {}
- const CompletionCallback& callback() const { return callback_; }
+ CompletionOnceCallback callback() {
+ return base::BindOnce(&CancelStreamCallback::CancelStream,
+ base::Unretained(this));
+ }
private:
void CancelStream(int result) {
@@ -119,7 +119,6 @@
}
SpdyHttpStream* stream_;
- CompletionCallback callback_;
};
} // namespace