| Index: net/spdy/spdy_session_unittest.cc
|
| diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
|
| index 44ec1faa34478379d5160ec63ed92d3035631429..40fafd62d9f3b1fd2b46267b467c88d7ae443798 100644
|
| --- a/net/spdy/spdy_session_unittest.cc
|
| +++ b/net/spdy/spdy_session_unittest.cc
|
| @@ -123,6 +123,7 @@ class SpdySessionTest : public PlatformTest {
|
| HttpNetworkSession::NORMAL_SOCKET_POOL)),
|
| old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool(
|
| HttpNetworkSession::NORMAL_SOCKET_POOL)),
|
| + test_push_delegate_(nullptr),
|
| spdy_session_pool_(nullptr),
|
| test_url_(kDefaultUrl),
|
| test_server_(test_url_),
|
| @@ -151,6 +152,10 @@ class SpdySessionTest : public PlatformTest {
|
| DCHECK(!spdy_session_pool_);
|
| http_session_ =
|
| SpdySessionDependencies::SpdyCreateSession(&session_deps_);
|
| + std::unique_ptr<TestServerPushDelegate> test_push_delegate(
|
| + new TestServerPushDelegate());
|
| + test_push_delegate_ = test_push_delegate.get();
|
| + http_session_->SetServerPushDelegate(std::move(test_push_delegate));
|
| spdy_session_pool_ = http_session_->spdy_session_pool();
|
| }
|
|
|
| @@ -209,7 +214,7 @@ class SpdySessionTest : public PlatformTest {
|
| SpdySessionDependencies session_deps_;
|
| std::unique_ptr<HttpNetworkSession> http_session_;
|
| base::WeakPtr<SpdySession> session_;
|
| - TestServerPushDelegate test_push_delegate_;
|
| + TestServerPushDelegate* test_push_delegate_;
|
| SpdySessionPool* spdy_session_pool_;
|
| const GURL test_url_;
|
| const url::SchemeHostPort test_server_;
|
| @@ -1310,7 +1315,6 @@ TEST_F(SpdySessionTest, CancelPushAfterSessionGoesAway) {
|
|
|
| CreateNetworkSession();
|
| CreateSecureSpdySession();
|
| - session_->set_push_delegate(&test_push_delegate_);
|
|
|
| // Process the principal request, and the first push stream request & body.
|
| base::WeakPtr<SpdyStream> spdy_stream =
|
| @@ -1358,7 +1362,7 @@ TEST_F(SpdySessionTest, CancelPushAfterSessionGoesAway) {
|
| // crash.
|
| EXPECT_FALSE(session_);
|
| EXPECT_TRUE(
|
| - test_push_delegate_.CancelPush(GURL("https://www.example.org/a.dat")));
|
| + test_push_delegate_->CancelPush(GURL("https://www.example.org/a.dat")));
|
|
|
| histogram_tester.ExpectBucketCount("Net.SpdySession.PushedBytes", 6, 1);
|
| histogram_tester.ExpectBucketCount("Net.SpdySession.PushedAndUnclaimedBytes",
|
| @@ -1396,7 +1400,6 @@ TEST_F(SpdySessionTest, CancelPushAfterExpired) {
|
|
|
| CreateNetworkSession();
|
| CreateSecureSpdySession();
|
| - session_->set_push_delegate(&test_push_delegate_);
|
|
|
| // Process the principal request, and the first push stream request & body.
|
| base::WeakPtr<SpdyStream> spdy_stream =
|
| @@ -1433,7 +1436,7 @@ TEST_F(SpdySessionTest, CancelPushAfterExpired) {
|
|
|
| // Cancel the first push after its expiration.
|
| EXPECT_TRUE(
|
| - test_push_delegate_.CancelPush(GURL("https://www.example.org/a.dat")));
|
| + test_push_delegate_->CancelPush(GURL("https://www.example.org/a.dat")));
|
| EXPECT_EQ(1u, session_->num_unclaimed_pushed_streams());
|
| EXPECT_TRUE(session_);
|
|
|
| @@ -1483,7 +1486,6 @@ TEST_F(SpdySessionTest, CancelPushBeforeClaimed) {
|
|
|
| CreateNetworkSession();
|
| CreateSecureSpdySession();
|
| - session_->set_push_delegate(&test_push_delegate_);
|
|
|
| // Process the principal request, and the first push stream request & body.
|
| base::WeakPtr<SpdyStream> spdy_stream =
|
| @@ -1524,7 +1526,7 @@ TEST_F(SpdySessionTest, CancelPushBeforeClaimed) {
|
|
|
| EXPECT_TRUE(session_);
|
| // Cancel the push before it's claimed.
|
| - EXPECT_TRUE(test_push_delegate_.CancelPush(pushed_url));
|
| + EXPECT_TRUE(test_push_delegate_->CancelPush(pushed_url));
|
| EXPECT_EQ(0u, session_->num_unclaimed_pushed_streams());
|
| EXPECT_EQ(0u, session_->count_unclaimed_pushed_streams_for_url(pushed_url));
|
|
|
|
|