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

Side by Side Diff: net/http/bidirectional_stream_unittest.cc

Issue 1812823010: Rename net::BidirectionalStream*Job to net::BidirectionalStream*Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/bidirectional_stream.h" 5 #include "net/http/bidirectional_stream.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 HttpNetworkSession::Params params = 346 HttpNetworkSession::Params params =
347 SpdySessionDependencies::CreateSessionParams(&session_deps_); 347 SpdySessionDependencies::CreateSessionParams(&session_deps_);
348 scoped_ptr<HttpNetworkSession> session(new HttpNetworkSession(params)); 348 scoped_ptr<HttpNetworkSession> session(new HttpNetworkSession(params));
349 delegate.SetRunUntilCompletion(true); 349 delegate.SetRunUntilCompletion(true);
350 delegate.Start(std::move(request_info), session.get()); 350 delegate.Start(std::move(request_info), session.get());
351 351
352 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, delegate.error()); 352 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, delegate.error());
353 } 353 }
354 354
355 // Simulates user calling ReadData after END_STREAM has been received in 355 // Simulates user calling ReadData after END_STREAM has been received in
356 // BidirectionalStreamSpdyJob. 356 // BidirectionalStreamSpdyImpl.
357 TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) { 357 TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) {
358 scoped_ptr<SpdyFrame> req( 358 scoped_ptr<SpdyFrame> req(
359 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST)); 359 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST));
360 // Empty DATA frame with an END_STREAM flag. 360 // Empty DATA frame with an END_STREAM flag.
361 scoped_ptr<SpdyFrame> end_stream( 361 scoped_ptr<SpdyFrame> end_stream(
362 spdy_util_.ConstructSpdyBodyFrame(1, nullptr, 0, true)); 362 spdy_util_.ConstructSpdyBodyFrame(1, nullptr, 0, true));
363 MockWrite writes[] = { 363 MockWrite writes[] = {
364 CreateMockWrite(*req.get(), 0), 364 CreateMockWrite(*req.get(), 0),
365 }; 365 };
366 366
(...skipping 24 matching lines...) Expand all
391 391
392 scoped_ptr<BidirectionalStreamRequestInfo> request_info( 392 scoped_ptr<BidirectionalStreamRequestInfo> request_info(
393 new BidirectionalStreamRequestInfo); 393 new BidirectionalStreamRequestInfo);
394 request_info->method = "GET"; 394 request_info->method = "GET";
395 request_info->url = GURL("https://www.example.org/"); 395 request_info->url = GURL("https://www.example.org/");
396 request_info->end_stream_on_headers = true; 396 request_info->end_stream_on_headers = true;
397 request_info->priority = LOWEST; 397 request_info->priority = LOWEST;
398 398
399 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); 399 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize));
400 // Create a MockTimer. Retain a raw pointer since the underlying 400 // Create a MockTimer. Retain a raw pointer since the underlying
401 // BidirectionalStreamJob owns it. 401 // BidirectionalStreamImpl owns it.
402 MockTimer* timer = new MockTimer(); 402 MockTimer* timer = new MockTimer();
403 scoped_ptr<TestDelegateBase> delegate(new TestDelegateBase( 403 scoped_ptr<TestDelegateBase> delegate(new TestDelegateBase(
404 read_buffer.get(), kReadBufferSize, make_scoped_ptr(timer))); 404 read_buffer.get(), kReadBufferSize, make_scoped_ptr(timer)));
405 delegate->set_do_not_start_read(true); 405 delegate->set_do_not_start_read(true);
406 406
407 delegate->Start(std::move(request_info), http_session_.get()); 407 delegate->Start(std::move(request_info), http_session_.get());
408 408
409 // Write request, and deliver response headers. 409 // Write request, and deliver response headers.
410 sequenced_data_->RunUntilPaused(); 410 sequenced_data_->RunUntilPaused();
411 EXPECT_FALSE(timer->IsRunning()); 411 EXPECT_FALSE(timer->IsRunning());
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 EXPECT_EQ("200", delegate->response_headers().find(":status")->second); 542 EXPECT_EQ("200", delegate->response_headers().find(":status")->second);
543 EXPECT_EQ(2, delegate->on_data_read_count()); 543 EXPECT_EQ(2, delegate->on_data_read_count());
544 EXPECT_EQ(3, delegate->on_data_sent_count()); 544 EXPECT_EQ(3, delegate->on_data_sent_count());
545 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); 545 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol());
546 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), 546 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)),
547 delegate->GetTotalSentBytes()); 547 delegate->GetTotalSentBytes());
548 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), 548 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)),
549 delegate->GetTotalReceivedBytes()); 549 delegate->GetTotalReceivedBytes());
550 } 550 }
551 551
552 // Tests that BidirectionalStreamSpdyJob::OnClose will complete any remaining 552 // Tests that BidirectionalStreamSpdyImpl::OnClose will complete any remaining
553 // read even if the read queue is empty. 553 // read even if the read queue is empty.
554 TEST_F(BidirectionalStreamTest, TestCompleteAsyncRead) { 554 TEST_F(BidirectionalStreamTest, TestCompleteAsyncRead) {
555 scoped_ptr<SpdyFrame> req( 555 scoped_ptr<SpdyFrame> req(
556 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST)); 556 spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST));
557 // Empty DATA frame with an END_STREAM flag. 557 // Empty DATA frame with an END_STREAM flag.
558 scoped_ptr<SpdyFrame> end_stream( 558 scoped_ptr<SpdyFrame> end_stream(
559 spdy_util_.ConstructSpdyBodyFrame(1, nullptr, 0, true)); 559 spdy_util_.ConstructSpdyBodyFrame(1, nullptr, 0, true));
560 560
561 MockWrite writes[] = {CreateMockWrite(*req.get(), 0)}; 561 MockWrite writes[] = {CreateMockWrite(*req.get(), 0)};
562 562
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1189
1190 // If stream is destroyed, do not call into stream. 1190 // If stream is destroyed, do not call into stream.
1191 if (!GetParam()) 1191 if (!GetParam())
1192 return; 1192 return;
1193 EXPECT_EQ(0, delegate->GetTotalSentBytes()); 1193 EXPECT_EQ(0, delegate->GetTotalSentBytes());
1194 EXPECT_EQ(0, delegate->GetTotalReceivedBytes()); 1194 EXPECT_EQ(0, delegate->GetTotalReceivedBytes());
1195 EXPECT_EQ(kProtoUnknown, delegate->GetProtocol()); 1195 EXPECT_EQ(kProtoUnknown, delegate->GetProtocol());
1196 } 1196 }
1197 1197
1198 } // namespace net 1198 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698