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 "content/child/resource_dispatcher.h" | 5 #include "content/child/resource_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/child/request_extra_data.h" | 24 #include "content/child/request_extra_data.h" |
25 #include "content/child/request_info.h" | 25 #include "content/child/request_info.h" |
26 #include "content/common/appcache_interfaces.h" | 26 #include "content/common/appcache_interfaces.h" |
27 #include "content/common/resource_messages.h" | 27 #include "content/common/resource_messages.h" |
28 #include "content/common/resource_request.h" | 28 #include "content/common/resource_request.h" |
29 #include "content/common/resource_request_completion_status.h" | 29 #include "content/common/resource_request_completion_status.h" |
30 #include "content/common/service_worker/service_worker_types.h" | 30 #include "content/common/service_worker/service_worker_types.h" |
31 #include "content/public/child/fixed_received_data.h" | 31 #include "content/public/child/fixed_received_data.h" |
32 #include "content/public/child/request_peer.h" | 32 #include "content/public/child/request_peer.h" |
33 #include "content/public/child/resource_dispatcher_delegate.h" | 33 #include "content/public/child/resource_dispatcher_delegate.h" |
34 #include "content/public/common/content_features.cc" | 34 #include "content/public/common/content_features.h" |
35 #include "content/public/common/resource_response.h" | 35 #include "content/public/common/resource_response.h" |
36 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
37 #include "net/http/http_response_headers.h" | 37 #include "net/http/http_response_headers.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
39 | 39 |
40 namespace content { | 40 namespace content { |
41 | 41 |
42 static const char kTestPageUrl[] = "http://www.google.com/"; | 42 static const char kTestPageUrl[] = "http://www.google.com/"; |
43 static const char kTestPageHeaders[] = | 43 static const char kTestPageHeaders[] = |
44 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; | 44 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 } | 543 } |
544 | 544 |
545 void OnCompletedRequest(int error_code, | 545 void OnCompletedRequest(int error_code, |
546 bool was_ignored_by_handler, | 546 bool was_ignored_by_handler, |
547 bool stale_copy_in_cache, | 547 bool stale_copy_in_cache, |
548 const std::string& security_info, | 548 const std::string& security_info, |
549 const base::TimeTicks& completion_time, | 549 const base::TimeTicks& completion_time, |
550 int64_t total_transfer_size) override { | 550 int64_t total_transfer_size) override { |
551 original_peer_->OnReceivedResponse(response_info_); | 551 original_peer_->OnReceivedResponse(response_info_); |
552 if (!data_.empty()) { | 552 if (!data_.empty()) { |
553 original_peer_->OnReceivedData(base::WrapUnique( | 553 original_peer_->OnReceivedData(base::WrapUnique(new FixedReceivedData( |
554 new FixedReceivedData(data_.data(), data_.size(), -1))); | 554 data_.data(), data_.size(), -1, data_.size()))); |
555 } | 555 } |
556 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, | 556 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, |
557 stale_copy_in_cache, security_info, | 557 stale_copy_in_cache, security_info, |
558 completion_time, total_transfer_size); | 558 completion_time, total_transfer_size); |
559 } | 559 } |
560 | 560 |
561 private: | 561 private: |
562 std::unique_ptr<RequestPeer> original_peer_; | 562 std::unique_ptr<RequestPeer> original_peer_; |
563 ResourceResponseInfo response_info_; | 563 ResourceResponseInfo response_info_; |
564 std::string data_; | 564 std::string data_; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 ResourceResponseHead response_head; | 934 ResourceResponseHead response_head; |
935 | 935 |
936 PerformTest(response_head); | 936 PerformTest(response_head); |
937 | 937 |
938 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 938 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
939 EXPECT_EQ(base::TimeTicks(), | 939 EXPECT_EQ(base::TimeTicks(), |
940 response_info().load_timing.connect_timing.dns_start); | 940 response_info().load_timing.connect_timing.dns_start); |
941 } | 941 } |
942 | 942 |
943 } // namespace content | 943 } // namespace content |
OLD | NEW |