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

Side by Side Diff: net/spdy/spdy_session_pool_unittest.cc

Issue 1779733003: Fix bug in net::RequestPriority -> HTTP/2 dependency conversion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make bi-directional stream unittests enable priority->dependency setting. 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
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 // an IP address change. Ensure sessions gracefully shut down. Regression test 513 // an IP address change. Ensure sessions gracefully shut down. Regression test
514 // for crbug.com/379469. 514 // for crbug.com/379469.
515 TEST_P(SpdySessionPoolTest, IPAddressChanged) { 515 TEST_P(SpdySessionPoolTest, IPAddressChanged) {
516 MockConnect connect_data(SYNCHRONOUS, OK); 516 MockConnect connect_data(SYNCHRONOUS, OK);
517 session_deps_.host_resolver->set_synchronous_mode(true); 517 session_deps_.host_resolver->set_synchronous_mode(true);
518 518
519 // This isn't testing anything having to do with SPDY frames; we 519 // This isn't testing anything having to do with SPDY frames; we
520 // can ignore issues of how dependencies are set. We default to 520 // can ignore issues of how dependencies are set. We default to
521 // setting them (when doing the appropriate protocol) since that's 521 // setting them (when doing the appropriate protocol) since that's
522 // where we're eventually headed for all HTTP/2 connections. 522 // where we're eventually headed for all HTTP/2 connections.
523 SpdyTestUtil spdy_util(GetParam(), true); 523 session_deps_.enable_priority_dependencies = true;
524 SpdySession::SetPriorityDependencyDefaultForTesting(true); 524 SpdyTestUtil spdy_util(GetParam(), /*enable_priority_dependencies*/ true);
525 525
526 MockRead reads[] = { 526 MockRead reads[] = {
527 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. 527 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
528 }; 528 };
529 scoped_ptr<SpdyFrame> req( 529 scoped_ptr<SpdyFrame> req(
530 spdy_util.ConstructSpdyGet("http://www.a.com", 1, MEDIUM)); 530 spdy_util.ConstructSpdyGet("http://www.a.com", 1, MEDIUM));
531 MockWrite writes[] = {CreateMockWrite(*req, 1)}; 531 MockWrite writes[] = {CreateMockWrite(*req, 1)};
532 532
533 StaticSocketDataProvider dataA(reads, arraysize(reads), writes, 533 StaticSocketDataProvider dataA(reads, arraysize(reads), writes,
534 arraysize(writes)); 534 arraysize(writes));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 EXPECT_TRUE(sessionA->IsDraining()); 623 EXPECT_TRUE(sessionA->IsDraining());
624 EXPECT_TRUE(sessionB->IsDraining()); 624 EXPECT_TRUE(sessionB->IsDraining());
625 EXPECT_TRUE(sessionC->IsDraining()); 625 EXPECT_TRUE(sessionC->IsDraining());
626 626
627 // Both streams were closed with an error. 627 // Both streams were closed with an error.
628 EXPECT_TRUE(delegateA.StreamIsClosed()); 628 EXPECT_TRUE(delegateA.StreamIsClosed());
629 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); 629 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose());
630 EXPECT_TRUE(delegateB.StreamIsClosed()); 630 EXPECT_TRUE(delegateB.StreamIsClosed());
631 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); 631 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
632 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) 632 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
633 SpdySession::SetPriorityDependencyDefaultForTesting(false);
634 } 633 }
635 634
636 TEST_P(SpdySessionPoolTest, FindAvailableSession) { 635 TEST_P(SpdySessionPoolTest, FindAvailableSession) {
637 SpdySessionKey key(HostPortPair("https://www.example.org", 443), 636 SpdySessionKey key(HostPortPair("https://www.example.org", 443),
638 ProxyServer::Direct(), PRIVACY_MODE_DISABLED); 637 ProxyServer::Direct(), PRIVACY_MODE_DISABLED);
639 638
640 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)}; 639 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)};
641 StaticSocketDataProvider data(reads, arraysize(reads), nullptr, 0); 640 StaticSocketDataProvider data(reads, arraysize(reads), nullptr, 0);
642 data.set_connect_data(MockConnect(SYNCHRONOUS, OK)); 641 data.set_connect_data(MockConnect(SYNCHRONOUS, OK));
643 session_deps_.socket_factory->AddSocketDataProvider(&data); 642 session_deps_.socket_factory->AddSocketDataProvider(&data);
(...skipping 20 matching lines...) Expand all
664 // there is no pushed stream on any sessions owned by |spdy_session_pool_|. 663 // there is no pushed stream on any sessions owned by |spdy_session_pool_|.
665 base::WeakPtr<SpdySession> session2 = 664 base::WeakPtr<SpdySession> session2 =
666 spdy_session_pool_->FindAvailableSession( 665 spdy_session_pool_->FindAvailableSession(
667 key, GURL("http://news.example.org/foo.html"), BoundNetLog()); 666 key, GURL("http://news.example.org/foo.html"), BoundNetLog());
668 EXPECT_EQ(session.get(), session2.get()); 667 EXPECT_EQ(session.get(), session2.get());
669 668
670 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); 669 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED);
671 } 670 }
672 671
673 } // namespace net 672 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698