| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "content/child/request_extra_data.h" | 16 #include "content/child/request_extra_data.h" |
| 17 #include "content/child/request_info.h" | 17 #include "content/child/request_info.h" |
| 18 #include "content/child/resource_dispatcher.h" | 18 #include "content/child/resource_dispatcher.h" |
| 19 #include "content/common/resource_messages.h" | 19 #include "content/common/resource_messages.h" |
| 20 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
| 21 #include "content/public/child/request_peer.h" | 21 #include "content/public/child/request_peer.h" |
| 22 #include "content/public/common/appcache_interfaces.h" |
| 22 #include "content/public/common/resource_response.h" | 23 #include "content/public/common/resource_response.h" |
| 23 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 24 #include "net/http/http_response_headers.h" | 25 #include "net/http/http_response_headers.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "webkit/child/resource_loader_bridge.h" | 27 #include "webkit/child/resource_loader_bridge.h" |
| 27 #include "webkit/common/appcache/appcache_interfaces.h" | |
| 28 | 28 |
| 29 using webkit_glue::ResourceLoaderBridge; | 29 using webkit_glue::ResourceLoaderBridge; |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 | 32 |
| 33 static const char kTestPageUrl[] = "http://www.google.com/"; | 33 static const char kTestPageUrl[] = "http://www.google.com/"; |
| 34 static const char kTestPageHeaders[] = | 34 static const char kTestPageHeaders[] = |
| 35 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; | 35 "HTTP/1.1 200 OK\nContent-Type:text/html\n\n"; |
| 36 static const char kTestPageMimeType[] = "text/html"; | 36 static const char kTestPageMimeType[] = "text/html"; |
| 37 static const char kTestPageCharset[] = ""; | 37 static const char kTestPageCharset[] = ""; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 ResourceLoaderBridge* CreateBridgeInternal(bool download_to_file) { | 324 ResourceLoaderBridge* CreateBridgeInternal(bool download_to_file) { |
| 325 RequestInfo request_info; | 325 RequestInfo request_info; |
| 326 request_info.method = "GET"; | 326 request_info.method = "GET"; |
| 327 request_info.url = GURL(kTestPageUrl); | 327 request_info.url = GURL(kTestPageUrl); |
| 328 request_info.first_party_for_cookies = GURL(kTestPageUrl); | 328 request_info.first_party_for_cookies = GURL(kTestPageUrl); |
| 329 request_info.referrer = GURL(); | 329 request_info.referrer = GURL(); |
| 330 request_info.headers = std::string(); | 330 request_info.headers = std::string(); |
| 331 request_info.load_flags = 0; | 331 request_info.load_flags = 0; |
| 332 request_info.requestor_pid = 0; | 332 request_info.requestor_pid = 0; |
| 333 request_info.request_type = ResourceType::SUB_RESOURCE; | 333 request_info.request_type = ResourceType::SUB_RESOURCE; |
| 334 request_info.appcache_host_id = appcache::kAppCacheNoHostId; | 334 request_info.appcache_host_id = kAppCacheNoHostId; |
| 335 request_info.routing_id = 0; | 335 request_info.routing_id = 0; |
| 336 request_info.download_to_file = download_to_file; | 336 request_info.download_to_file = download_to_file; |
| 337 RequestExtraData extra_data; | 337 RequestExtraData extra_data; |
| 338 request_info.extra_data = &extra_data; | 338 request_info.extra_data = &extra_data; |
| 339 | 339 |
| 340 return dispatcher_.CreateBridge(request_info); | 340 return dispatcher_.CreateBridge(request_info); |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Map of request IDs to shared memory. | 343 // Map of request IDs to shared memory. |
| 344 std::map<int, base::SharedMemory*> shared_memory_map_; | 344 std::map<int, base::SharedMemory*> shared_memory_map_; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 response_head.error_code = net::OK; | 794 response_head.error_code = net::OK; |
| 795 | 795 |
| 796 PerformTest(response_head); | 796 PerformTest(response_head); |
| 797 | 797 |
| 798 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); | 798 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); |
| 799 EXPECT_EQ(base::TimeTicks(), | 799 EXPECT_EQ(base::TimeTicks(), |
| 800 response_info().load_timing.connect_timing.dns_start); | 800 response_info().load_timing.connect_timing.dns_start); |
| 801 } | 801 } |
| 802 | 802 |
| 803 } // namespace content | 803 } // namespace content |
| OLD | NEW |