OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/scheduler/child/web_task_runner_impl.h" | |
17 #include "content/child/request_extra_data.h" | 16 #include "content/child/request_extra_data.h" |
18 #include "content/child/request_info.h" | 17 #include "content/child/request_info.h" |
19 #include "content/child/resource_dispatcher.h" | 18 #include "content/child/resource_dispatcher.h" |
20 #include "content/public/child/fixed_received_data.h" | 19 #include "content/public/child/fixed_received_data.h" |
21 #include "content/public/child/request_peer.h" | 20 #include "content/public/child/request_peer.h" |
22 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
23 #include "content/public/common/resource_response_info.h" | 22 #include "content/public/common/resource_response_info.h" |
24 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
25 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
26 #include "net/http/http_util.h" | 25 #include "net/http/http_util.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 GURL url_; | 99 GURL url_; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); | 101 DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher); |
103 }; | 102 }; |
104 | 103 |
105 class TestWebURLLoaderClient : public blink::WebURLLoaderClient { | 104 class TestWebURLLoaderClient : public blink::WebURLLoaderClient { |
106 public: | 105 public: |
107 TestWebURLLoaderClient( | 106 TestWebURLLoaderClient( |
108 ResourceDispatcher* dispatcher, | 107 ResourceDispatcher* dispatcher, |
109 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
110 : loader_( | 109 : loader_(new WebURLLoaderImpl(dispatcher, task_runner)), |
111 new WebURLLoaderImpl( | |
112 dispatcher, | |
113 make_scoped_ptr(new scheduler::WebTaskRunnerImpl(task_runner)))), | |
114 expect_multipart_response_(false), | 110 expect_multipart_response_(false), |
115 delete_on_receive_redirect_(false), | 111 delete_on_receive_redirect_(false), |
116 delete_on_receive_response_(false), | 112 delete_on_receive_response_(false), |
117 delete_on_receive_data_(false), | 113 delete_on_receive_data_(false), |
118 delete_on_finish_(false), | 114 delete_on_finish_(false), |
119 delete_on_fail_(false), | 115 delete_on_fail_(false), |
120 did_receive_redirect_(false), | 116 did_receive_redirect_(false), |
121 did_receive_response_(false), | 117 did_receive_response_(false), |
122 did_finish_(false) {} | 118 did_finish_(false) {} |
123 | 119 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 EXPECT_EQ(kMimeType, client()->response().mimeType().latin1()); | 707 EXPECT_EQ(kMimeType, client()->response().mimeType().latin1()); |
712 | 708 |
713 DoReceiveData(); | 709 DoReceiveData(); |
714 DoCompleteRequest(); | 710 DoCompleteRequest(); |
715 EXPECT_FALSE(dispatcher()->canceled()); | 711 EXPECT_FALSE(dispatcher()->canceled()); |
716 EXPECT_EQ(kTestData, client()->received_data()); | 712 EXPECT_EQ(kTestData, client()->received_data()); |
717 } | 713 } |
718 | 714 |
719 } // namespace | 715 } // namespace |
720 } // namespace content | 716 } // namespace content |
OLD | NEW |