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

Unified Diff: net/http/bidirectional_stream_unittest.cc

Issue 2043863002: Use WeakPtrFactory in net::BidirectionalStream when posting task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Matt's comments Created 4 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 | « net/http/bidirectional_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/bidirectional_stream_unittest.cc
diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc
index 2389ffab70ca54a578a30a736ce98d1d5f1ec327..e96f54c4ac8c8a7e7401b56cbd82364bd28298c6 100644
--- a/net/http/bidirectional_stream_unittest.cc
+++ b/net/http/bidirectional_stream_unittest.cc
@@ -390,6 +390,26 @@ TEST_F(BidirectionalStreamTest, CreateInsecureStream) {
EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, delegate.error());
}
+// Creates a BidirectionalStream with an insecure scheme. Destroy the stream
+// without waiting for the OnFailed task to be executed.
+TEST_F(BidirectionalStreamTest,
+ CreateInsecureStreamAndDestroyStreamRightAfter) {
+ std::unique_ptr<BidirectionalStreamRequestInfo> request_info(
+ new BidirectionalStreamRequestInfo);
+ request_info->method = "GET";
+ request_info->url = GURL("http://www.example.org/");
+
+ std::unique_ptr<TestDelegateBase> delegate(new TestDelegateBase(nullptr, 0));
+ HttpNetworkSession::Params params =
+ SpdySessionDependencies::CreateSessionParams(&session_deps_);
+ std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params));
+ delegate->Start(std::move(request_info), session.get());
+ // Reset stream right before the OnFailed task is executed.
+ delegate.reset();
+
+ base::RunLoop().RunUntilIdle();
+}
+
// Simulates user calling ReadData after END_STREAM has been received in
// BidirectionalStreamSpdyImpl.
TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) {
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698