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

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

Issue 304353012: Introduce STATE_RESERVED_REMOTE. No behavioral changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android build. More robust expectation Created 6 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4515 4515
4516 // Read response headers & body. Body overflows the session window, and a 4516 // Read response headers & body. Body overflows the session window, and a
4517 // goaway is written. 4517 // goaway is written.
4518 data.RunFor(3); 4518 data.RunFor(3);
4519 base::MessageLoop::current()->RunUntilIdle(); 4519 base::MessageLoop::current()->RunUntilIdle();
4520 4520
4521 EXPECT_EQ(ERR_SPDY_FLOW_CONTROL_ERROR, delegate.WaitForClose()); 4521 EXPECT_EQ(ERR_SPDY_FLOW_CONTROL_ERROR, delegate.WaitForClose());
4522 EXPECT_TRUE(session == NULL); 4522 EXPECT_TRUE(session == NULL);
4523 } 4523 }
4524 4524
4525 TEST_P(SpdySessionTest, SplitHeaders) {
4526 GURL kStreamUrl("http://www.google.com/foo.dat");
4527 SpdyHeaderBlock headers;
4528 spdy_util_.AddUrlToHeaderBlock(kStreamUrl.spec(), &headers);
4529 headers["alpha"] = "beta";
4530
4531 SpdyHeaderBlock request_headers;
4532 SpdyHeaderBlock response_headers;
4533
4534 SplitPushedHeadersToRequestAndResponse(
4535 headers, spdy_util_.spdy_version(), &request_headers, &response_headers);
4536
4537 SpdyHeaderBlock::const_iterator it = response_headers.find("alpha");
4538 std::string alpha_val =
4539 (it == response_headers.end()) ? std::string() : it->second;
4540 EXPECT_EQ("beta", alpha_val);
4541
4542 GURL request_url =
4543 GetUrlFromHeaderBlock(request_headers, spdy_util_.spdy_version(), true);
4544 EXPECT_EQ(kStreamUrl, request_url);
4545 }
4546
4525 TEST(MapFramerErrorToProtocolError, MapsValues) { 4547 TEST(MapFramerErrorToProtocolError, MapsValues) {
4526 CHECK_EQ( 4548 CHECK_EQ(
4527 SPDY_ERROR_INVALID_CONTROL_FRAME, 4549 SPDY_ERROR_INVALID_CONTROL_FRAME,
4528 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME)); 4550 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_CONTROL_FRAME));
4529 CHECK_EQ( 4551 CHECK_EQ(
4530 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS, 4552 SPDY_ERROR_INVALID_DATA_FRAME_FLAGS,
4531 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS)); 4553 MapFramerErrorToProtocolError(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
4532 CHECK_EQ( 4554 CHECK_EQ(
4533 SPDY_ERROR_GOAWAY_FRAME_CORRUPT, 4555 SPDY_ERROR_GOAWAY_FRAME_CORRUPT,
4534 MapFramerErrorToProtocolError(SpdyFramer::SPDY_GOAWAY_FRAME_CORRUPT)); 4556 MapFramerErrorToProtocolError(SpdyFramer::SPDY_GOAWAY_FRAME_CORRUPT));
(...skipping 30 matching lines...) Expand all
4565 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, 4587 CHECK_EQ(GOAWAY_PROTOCOL_ERROR,
4566 MapNetErrorToGoAwayStatus(ERR_SPDY_PROTOCOL_ERROR)); 4588 MapNetErrorToGoAwayStatus(ERR_SPDY_PROTOCOL_ERROR));
4567 CHECK_EQ(GOAWAY_COMPRESSION_ERROR, 4589 CHECK_EQ(GOAWAY_COMPRESSION_ERROR,
4568 MapNetErrorToGoAwayStatus(ERR_SPDY_COMPRESSION_ERROR)); 4590 MapNetErrorToGoAwayStatus(ERR_SPDY_COMPRESSION_ERROR));
4569 CHECK_EQ(GOAWAY_FRAME_SIZE_ERROR, 4591 CHECK_EQ(GOAWAY_FRAME_SIZE_ERROR,
4570 MapNetErrorToGoAwayStatus(ERR_SPDY_FRAME_SIZE_ERROR)); 4592 MapNetErrorToGoAwayStatus(ERR_SPDY_FRAME_SIZE_ERROR));
4571 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, MapNetErrorToGoAwayStatus(ERR_UNEXPECTED)); 4593 CHECK_EQ(GOAWAY_PROTOCOL_ERROR, MapNetErrorToGoAwayStatus(ERR_UNEXPECTED));
4572 } 4594 }
4573 4595
4574 } // namespace net 4596 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698