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 ResourceResponseHead* response_head) { | 54 ResourceResponseHead* response_head) { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 public IPC::Sender { | 523 public IPC::Sender { |
520 public: | 524 public: |
521 ResourceDispatcherHostTest() | 525 ResourceDispatcherHostTest() |
522 : ui_thread_(BrowserThread::UI, &message_loop_), | 526 : ui_thread_(BrowserThread::UI, &message_loop_), |
523 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 527 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
524 cache_thread_(BrowserThread::CACHE, &message_loop_), | 528 cache_thread_(BrowserThread::CACHE, &message_loop_), |
525 io_thread_(BrowserThread::IO, &message_loop_), | 529 io_thread_(BrowserThread::IO, &message_loop_), |
526 old_factory_(NULL), | 530 old_factory_(NULL), |
527 resource_type_(ResourceType::SUB_RESOURCE), | 531 resource_type_(ResourceType::SUB_RESOURCE), |
528 send_data_received_acks_(false) { | 532 send_data_received_acks_(false) { |
| 533 #if defined(OS_MACOSX) |
| 534 // Call it before PowerMonitor's ctor. |
| 535 base::PowerMonitor::AllocateSystemIOPorts(); |
| 536 #endif |
529 browser_context_.reset(new TestBrowserContext()); | 537 browser_context_.reset(new TestBrowserContext()); |
530 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); | 538 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
531 message_loop_.RunAllPending(); | 539 message_loop_.RunAllPending(); |
532 filter_ = new ForwardingFilter( | 540 filter_ = new ForwardingFilter( |
533 this, browser_context_->GetResourceContext()); | 541 this, browser_context_->GetResourceContext()); |
534 } | 542 } |
535 // IPC::Sender implementation | 543 // IPC::Sender implementation |
536 virtual bool Send(IPC::Message* msg) { | 544 virtual bool Send(IPC::Message* msg) { |
537 accum_.AddMessage(*msg); | 545 accum_.AddMessage(*msg); |
538 | 546 |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 } | 1955 } |
1948 | 1956 |
1949 MessageLoop::current()->RunAllPending(); | 1957 MessageLoop::current()->RunAllPending(); |
1950 | 1958 |
1951 msgs.clear(); | 1959 msgs.clear(); |
1952 accum_.GetClassifiedMessages(&msgs); | 1960 accum_.GetClassifiedMessages(&msgs); |
1953 } | 1961 } |
1954 } | 1962 } |
1955 | 1963 |
1956 } // namespace content | 1964 } // namespace content |
OLD | NEW |