| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/tools/quic/quic_simple_server_session.h" | 5 #include "net/tools/quic/quic_simple_server_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 SpdyHeaderBlock request_headers; | 469 SpdyHeaderBlock request_headers; |
| 470 string resource_host = "www.google.com"; | 470 string resource_host = "www.google.com"; |
| 471 string partial_push_resource_path = "/server_push_src"; | 471 string partial_push_resource_path = "/server_push_src"; |
| 472 std::list<QuicInMemoryCache::ServerPushInfo> push_resources; | 472 std::list<QuicInMemoryCache::ServerPushInfo> push_resources; |
| 473 string scheme = "http"; | 473 string scheme = "http"; |
| 474 for (unsigned int i = 1; i <= num_resources; ++i) { | 474 for (unsigned int i = 1; i <= num_resources; ++i) { |
| 475 QuicStreamId stream_id = i * 2; | 475 QuicStreamId stream_id = i * 2; |
| 476 string path = partial_push_resource_path + base::UintToString(i); | 476 string path = partial_push_resource_path + base::UintToString(i); |
| 477 string url = scheme + "://" + resource_host + path; | 477 string url = scheme + "://" + resource_host + path; |
| 478 GURL resource_url = GURL(url); | 478 GURL resource_url = GURL(url); |
| 479 string body; | 479 string body(body_size, 'a'); |
| 480 GenerateBody(&body, body_size); | |
| 481 in_memory_cache_.AddSimpleResponse(resource_host, path, 200, body); | 480 in_memory_cache_.AddSimpleResponse(resource_host, path, 200, body); |
| 482 push_resources.push_back(QuicInMemoryCache::ServerPushInfo( | 481 push_resources.push_back(QuicInMemoryCache::ServerPushInfo( |
| 483 resource_url, SpdyHeaderBlock(), kDefaultPriority, body)); | 482 resource_url, SpdyHeaderBlock(), kDefaultPriority, body)); |
| 484 // PUSH_PROMISED are sent for all the resources. | 483 // PUSH_PROMISED are sent for all the resources. |
| 485 EXPECT_CALL(*headers_stream_, | 484 EXPECT_CALL(*headers_stream_, |
| 486 WritePushPromiseMock(kClientDataStreamId1, stream_id, _)); | 485 WritePushPromiseMock(kClientDataStreamId1, stream_id, _)); |
| 487 if (i <= kMaxStreamsForTest) { | 486 if (i <= kMaxStreamsForTest) { |
| 488 // |kMaxStreamsForTest| promised responses should be sent. | 487 // |kMaxStreamsForTest| promised responses should be sent. |
| 489 EXPECT_CALL( | 488 EXPECT_CALL( |
| 490 *headers_stream_, | 489 *headers_stream_, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); | 622 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); |
| 624 | 623 |
| 625 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 624 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
| 626 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 625 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
| 627 visitor_->OnRstStream(rst); | 626 visitor_->OnRstStream(rst); |
| 628 } | 627 } |
| 629 | 628 |
| 630 } // namespace | 629 } // namespace |
| 631 } // namespace test | 630 } // namespace test |
| 632 } // namespace net | 631 } // namespace net |
| OLD | NEW |