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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
11 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
12 #include "content/child/request_extra_data.h" | 12 #include "content/child/request_extra_data.h" |
13 #include "content/child/resource_dispatcher.h" | 13 #include "content/child/resource_dispatcher.h" |
14 #include "content/common/resource_messages.h" | 14 #include "content/common/resource_messages.h" |
15 #include "content/public/common/resource_response.h" | 15 #include "content/public/common/resource_response.h" |
16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "webkit/common/appcache/appcache_interfaces.h" | 19 #include "webkit/common/appcache/appcache_interfaces.h" |
20 | 20 |
21 using webkit_glue::ResourceLoaderBridge; | |
22 using webkit_glue::ResourceResponseInfo; | 21 using webkit_glue::ResourceResponseInfo; |
23 | 22 |
24 namespace content { | 23 namespace content { |
25 | 24 |
26 static const char test_page_url[] = "http://www.google.com/"; | 25 static const char test_page_url[] = "http://www.google.com/"; |
27 static const char test_page_headers[] = | 26 static const char test_page_headers[] = |
28 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; | 27 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; |
29 static const char test_page_mime_type[] = "text/html"; | 28 static const char test_page_mime_type[] = "text/html"; |
30 static const char test_page_charset[] = ""; | 29 static const char test_page_charset[] = ""; |
31 static const char test_page_contents[] = | 30 static const char test_page_contents[] = |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 protected: | 155 protected: |
157 // testing::Test | 156 // testing::Test |
158 virtual void SetUp() OVERRIDE { | 157 virtual void SetUp() OVERRIDE { |
159 dispatcher_.reset(new ResourceDispatcher(this)); | 158 dispatcher_.reset(new ResourceDispatcher(this)); |
160 } | 159 } |
161 virtual void TearDown() OVERRIDE { | 160 virtual void TearDown() OVERRIDE { |
162 dispatcher_.reset(); | 161 dispatcher_.reset(); |
163 } | 162 } |
164 | 163 |
165 ResourceLoaderBridge* CreateBridge() { | 164 ResourceLoaderBridge* CreateBridge() { |
166 webkit_glue::ResourceLoaderBridge::RequestInfo request_info; | 165 ResourceLoaderBridge::RequestInfo request_info; |
167 request_info.method = "GET"; | 166 request_info.method = "GET"; |
168 request_info.url = GURL(test_page_url); | 167 request_info.url = GURL(test_page_url); |
169 request_info.first_party_for_cookies = GURL(test_page_url); | 168 request_info.first_party_for_cookies = GURL(test_page_url); |
170 request_info.referrer = GURL(); | 169 request_info.referrer = GURL(); |
171 request_info.headers = std::string(); | 170 request_info.headers = std::string(); |
172 request_info.load_flags = 0; | 171 request_info.load_flags = 0; |
173 request_info.requestor_pid = 0; | 172 request_info.requestor_pid = 0; |
174 request_info.request_type = ResourceType::SUB_RESOURCE; | 173 request_info.request_type = ResourceType::SUB_RESOURCE; |
175 request_info.appcache_host_id = appcache::kNoHostId; | 174 request_info.appcache_host_id = appcache::kNoHostId; |
176 request_info.routing_id = 0; | 175 request_info.routing_id = 0; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 response_head.error_code = net::OK; | 436 response_head.error_code = net::OK; |
438 | 437 |
439 PerformTest(response_head); | 438 PerformTest(response_head); |
440 | 439 |
441 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 440 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
442 EXPECT_EQ(base::TimeTicks(), | 441 EXPECT_EQ(base::TimeTicks(), |
443 response_info().load_timing.connect_timing.dns_start); | 442 response_info().load_timing.connect_timing.dns_start); |
444 } | 443 } |
445 | 444 |
446 } // namespace content | 445 } // namespace content |
OLD | NEW |