OLD | NEW |
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/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "net/test/gtest_util.h" | 29 #include "net/test/gtest_util.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gmock_mutant.h" | 31 #include "testing/gmock_mutant.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 using base::hash_map; | 34 using base::hash_map; |
35 using std::set; | 35 using std::set; |
36 using std::string; | 36 using std::string; |
37 using std::vector; | 37 using std::vector; |
38 using testing::CreateFunctor; | 38 using testing::CreateFunctor; |
| 39 using net::SpdyPriority; |
39 using testing::InSequence; | 40 using testing::InSequence; |
40 using testing::Invoke; | 41 using testing::Invoke; |
41 using testing::Return; | 42 using testing::Return; |
42 using testing::StrictMock; | 43 using testing::StrictMock; |
43 using testing::_; | 44 using testing::_; |
44 | 45 |
45 namespace net { | 46 namespace net { |
46 namespace test { | 47 namespace test { |
47 namespace { | 48 namespace { |
48 | 49 |
49 const QuicPriority kHighestPriority = 0; | 50 const SpdyPriority kHighestPriority = 0; |
50 const QuicPriority kSomeMiddlePriority = 3; | 51 const SpdyPriority kSomeMiddlePriority = 3; |
51 | 52 |
52 class TestCryptoStream : public QuicCryptoStream { | 53 class TestCryptoStream : public QuicCryptoStream { |
53 public: | 54 public: |
54 explicit TestCryptoStream(QuicSession* session) | 55 explicit TestCryptoStream(QuicSession* session) |
55 : QuicCryptoStream(session) { | 56 : QuicCryptoStream(session) { |
56 } | 57 } |
57 | 58 |
58 void OnHandshakeMessage(const CryptoHandshakeMessage& /*message*/) override { | 59 void OnHandshakeMessage(const CryptoHandshakeMessage& /*message*/) override { |
59 encryption_established_ = true; | 60 encryption_established_ = true; |
60 handshake_confirmed_ = true; | 61 handshake_confirmed_ = true; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // Close the stream. | 380 // Close the stream. |
380 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _)); | 381 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _)); |
381 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); | 382 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); |
382 EXPECT_DEBUG_DFATAL(session_.MarkConnectionLevelWriteBlocked( | 383 EXPECT_DEBUG_DFATAL(session_.MarkConnectionLevelWriteBlocked( |
383 closed_stream_id, kSomeMiddlePriority), | 384 closed_stream_id, kSomeMiddlePriority), |
384 "Marking unknown stream 2 blocked."); | 385 "Marking unknown stream 2 blocked."); |
385 } | 386 } |
386 | 387 |
387 TEST_P(QuicSessionTestServer, | 388 TEST_P(QuicSessionTestServer, |
388 DebugDFatalIfMarkWriteBlockedCalledWithWrongPriority) { | 389 DebugDFatalIfMarkWriteBlockedCalledWithWrongPriority) { |
389 const QuicPriority kDifferentPriority = 0; | 390 const SpdyPriority kDifferentPriority = 0; |
390 | 391 |
391 TestStream* stream2 = session_.CreateOutgoingDynamicStream(); | 392 TestStream* stream2 = session_.CreateOutgoingDynamicStream(); |
392 EXPECT_NE(kDifferentPriority, stream2->Priority()); | 393 EXPECT_NE(kDifferentPriority, stream2->Priority()); |
393 EXPECT_DEBUG_DFATAL(session_.MarkConnectionLevelWriteBlocked( | 394 EXPECT_DEBUG_DFATAL(session_.MarkConnectionLevelWriteBlocked( |
394 stream2->id(), kDifferentPriority), | 395 stream2->id(), kDifferentPriority), |
395 "Priorities do not match. Got: 0 Expected: 3"); | 396 "Priorities do not match. Got: 0 Expected: 3"); |
396 } | 397 } |
397 | 398 |
398 TEST_P(QuicSessionTestServer, OnCanWrite) { | 399 TEST_P(QuicSessionTestServer, OnCanWrite) { |
399 TestStream* stream2 = session_.CreateOutgoingDynamicStream(); | 400 TestStream* stream2 = session_.CreateOutgoingDynamicStream(); |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 // Verify that there is no entry for the stream in | 1186 // Verify that there is no entry for the stream in |
1186 // locally_closed_streams_highest_offset_. | 1187 // locally_closed_streams_highest_offset_. |
1187 EXPECT_EQ( | 1188 EXPECT_EQ( |
1188 FLAGS_quic_fix_fin_accounting ? 0u : 1u, | 1189 FLAGS_quic_fix_fin_accounting ? 0u : 1u, |
1189 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(&session_).size()); | 1190 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(&session_).size()); |
1190 } | 1191 } |
1191 | 1192 |
1192 } // namespace | 1193 } // namespace |
1193 } // namespace test | 1194 } // namespace test |
1194 } // namespace net | 1195 } // namespace net |
OLD | NEW |