| 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/browser/renderer_host/resource_dispatcher_host_impl.h" | 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "net/base/upload_data.h" | 31 #include "net/base/upload_data.h" |
| 32 #include "net/http/http_util.h" | 32 #include "net/http/http_util.h" |
| 33 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" |
| 34 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
| 35 #include "net/url_request/url_request_job.h" | 35 #include "net/url_request/url_request_job.h" |
| 36 #include "net/url_request/url_request_simple_job.h" | 36 #include "net/url_request/url_request_simple_job.h" |
| 37 #include "net/url_request/url_request_test_job.h" | 37 #include "net/url_request/url_request_test_job.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "webkit/appcache/appcache_interfaces.h" | 39 #include "webkit/appcache/appcache_interfaces.h" |
| 40 | 40 |
| 41 #if defined(OS_MACOSX) |
| 42 #include "base/power_monitor/power_monitor.h" |
| 43 #endif |
| 44 |
| 41 // TODO(eroman): Write unit tests for SafeBrowsing that exercise | 45 // TODO(eroman): Write unit tests for SafeBrowsing that exercise |
| 42 // SafeBrowsingResourceHandler. | 46 // SafeBrowsingResourceHandler. |
| 43 | 47 |
| 44 namespace content { | 48 namespace content { |
| 45 | 49 |
| 46 namespace { | 50 namespace { |
| 47 | 51 |
| 48 // Returns the resource response header structure for this request. | 52 // Returns the resource response header structure for this request. |
| 49 void GetResponseHead(const std::vector<IPC::Message>& messages, | 53 void GetResponseHead(const std::vector<IPC::Message>& messages, |
| 50 content::ResourceResponseHead* response_head) { | 54 content::ResourceResponseHead* response_head) { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 public IPC::Sender { | 498 public IPC::Sender { |
| 495 public: | 499 public: |
| 496 ResourceDispatcherHostTest() | 500 ResourceDispatcherHostTest() |
| 497 : ui_thread_(BrowserThread::UI, &message_loop_), | 501 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 498 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 502 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
| 499 cache_thread_(BrowserThread::CACHE, &message_loop_), | 503 cache_thread_(BrowserThread::CACHE, &message_loop_), |
| 500 io_thread_(BrowserThread::IO, &message_loop_), | 504 io_thread_(BrowserThread::IO, &message_loop_), |
| 501 old_factory_(NULL), | 505 old_factory_(NULL), |
| 502 resource_type_(ResourceType::SUB_RESOURCE), | 506 resource_type_(ResourceType::SUB_RESOURCE), |
| 503 send_data_received_acks_(false) { | 507 send_data_received_acks_(false) { |
| 508 #if defined(OS_MACOSX) |
| 509 // Call it before PowerMonitor's ctor. |
| 510 base::PowerMonitor::AllocateSystemIOPorts(); |
| 511 #endif |
| 504 browser_context_.reset(new content::TestBrowserContext()); | 512 browser_context_.reset(new content::TestBrowserContext()); |
| 505 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); | 513 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
| 506 message_loop_.RunAllPending(); | 514 message_loop_.RunAllPending(); |
| 507 filter_ = new ForwardingFilter( | 515 filter_ = new ForwardingFilter( |
| 508 this, browser_context_->GetResourceContext()); | 516 this, browser_context_->GetResourceContext()); |
| 509 } | 517 } |
| 510 // IPC::Sender implementation | 518 // IPC::Sender implementation |
| 511 virtual bool Send(IPC::Message* msg) { | 519 virtual bool Send(IPC::Message* msg) { |
| 512 accum_.AddMessage(*msg); | 520 accum_.AddMessage(*msg); |
| 513 | 521 |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 } | 1861 } |
| 1854 | 1862 |
| 1855 MessageLoop::current()->RunAllPending(); | 1863 MessageLoop::current()->RunAllPending(); |
| 1856 | 1864 |
| 1857 msgs.clear(); | 1865 msgs.clear(); |
| 1858 accum_.GetClassifiedMessages(&msgs); | 1866 accum_.GetClassifiedMessages(&msgs); |
| 1859 } | 1867 } |
| 1860 } | 1868 } |
| 1861 | 1869 |
| 1862 } // namespace content | 1870 } // namespace content |
| OLD | NEW |