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

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

Issue 1411383005: Initial implementation of RequestPriority-based HTTP/2 dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests. Created 5 years, 1 month 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 (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 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) { 503 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) {
504 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS); 504 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS);
505 } 505 }
506 506
507 // Construct a Pool with SpdySessions in various availability states. Simulate 507 // Construct a Pool with SpdySessions in various availability states. Simulate
508 // an IP address change. Ensure sessions gracefully shut down. Regression test 508 // an IP address change. Ensure sessions gracefully shut down. Regression test
509 // for crbug.com/379469. 509 // for crbug.com/379469.
510 TEST_P(SpdySessionPoolTest, IPAddressChanged) { 510 TEST_P(SpdySessionPoolTest, IPAddressChanged) {
511 MockConnect connect_data(SYNCHRONOUS, OK); 511 MockConnect connect_data(SYNCHRONOUS, OK);
512 session_deps_.host_resolver->set_synchronous_mode(true); 512 session_deps_.host_resolver->set_synchronous_mode(true);
513 SpdyTestUtil spdy_util(GetParam()); 513
514 // This isn't testing anything having to do with Spdy frames; we
515 // can ignore issues of how dependencies are set. We default to
516 // setting them (when doing the appropriate protocol) since that's
517 // where we're eventually headed for all HTTP/2 connections.
518 SpdyTestUtil spdy_util(GetParam(), true);
519 SpdySession::SetPriorityDependencyDefaultForTesting(true);
514 520
515 MockRead reads[] = { 521 MockRead reads[] = {
516 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. 522 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
517 }; 523 };
518 scoped_ptr<SpdyFrame> req( 524 scoped_ptr<SpdyFrame> req(
519 spdy_util.ConstructSpdyGet("http://www.a.com", false, 1, MEDIUM)); 525 spdy_util.ConstructSpdyGet("http://www.a.com", false, 1, MEDIUM));
520 MockWrite writes[] = {CreateMockWrite(*req, 1)}; 526 MockWrite writes[] = {CreateMockWrite(*req, 1)};
521 527
522 StaticSocketDataProvider data(reads, arraysize(reads), writes, 528 StaticSocketDataProvider data(reads, arraysize(reads), writes,
523 arraysize(writes)); 529 arraysize(writes));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 EXPECT_TRUE(sessionA->IsDraining()); 612 EXPECT_TRUE(sessionA->IsDraining());
607 EXPECT_TRUE(sessionB->IsDraining()); 613 EXPECT_TRUE(sessionB->IsDraining());
608 EXPECT_TRUE(sessionC->IsDraining()); 614 EXPECT_TRUE(sessionC->IsDraining());
609 615
610 // Both streams were closed with an error. 616 // Both streams were closed with an error.
611 EXPECT_TRUE(delegateA.StreamIsClosed()); 617 EXPECT_TRUE(delegateA.StreamIsClosed());
612 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); 618 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose());
613 EXPECT_TRUE(delegateB.StreamIsClosed()); 619 EXPECT_TRUE(delegateB.StreamIsClosed());
614 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); 620 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose());
615 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) 621 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
622 SpdySession::SetPriorityDependencyDefaultForTesting(false);
616 } 623 }
617 624
618 } // namespace 625 } // namespace
619 626
620 } // namespace net 627 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698