Index: content/browser/renderer_host/resource_dispatcher_host_unittest.cc |
diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc |
index 6d9694913a2b2a1c68fdb6a177925d934b346aab..aa1af5d17f51f0c6bdfa0a81d3201ddb5f24439d 100644 |
--- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc |
+++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc |
@@ -24,6 +24,7 @@ |
#include "content/public/browser/resource_context.h" |
#include "content/public/browser/resource_dispatcher_host_delegate.h" |
#include "content/public/browser/resource_throttle.h" |
+#include "content/public/browser/storage_partition.h" |
#include "content/public/common/resource_response.h" |
#include "content/public/test/test_browser_context.h" |
#include "content/test/test_content_browser_client.h" |
@@ -67,6 +68,11 @@ void GenerateIPCMessage( |
*message, filter.get(), &msg_is_ok); |
} |
+ResourceContext* GetResourceContextForTest(BrowserContext* context) { |
+ return BrowserContext::GetDefaultStoragePartition(context)-> |
+ GetResourceContext(); |
+} |
+ |
} // namespace |
static int RequestIDForMessage(const IPC::Message& msg) { |
@@ -464,7 +470,7 @@ class ResourceDispatcherHostTest : public testing::Test, |
BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
message_loop_.RunAllPending(); |
filter_ = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
} |
// IPC::Sender implementation |
virtual bool Send(IPC::Message* msg) { |
@@ -512,7 +518,7 @@ class ResourceDispatcherHostTest : public testing::Test, |
// Flush the message loop to make application verifiers happy. |
if (ResourceDispatcherHostImpl::Get()) |
ResourceDispatcherHostImpl::Get()->CancelRequestsForContext( |
- browser_context_->GetResourceContext()); |
+ GetResourceContextForTest(browser_context_.get())); |
browser_context_.reset(); |
message_loop_.RunAllPending(); |
} |
@@ -873,7 +879,7 @@ class TestFilter : public ForwardingFilter { |
// Tests CancelRequestsForProcess |
TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { |
scoped_refptr<TestFilter> test_filter = new TestFilter( |
- browser_context_->GetResourceContext()); |
+ GetResourceContextForTest(browser_context_.get())); |
// request 1 goes to the test delegate |
ResourceHostMsg_Request request = CreateResourceRequest( |
@@ -1027,7 +1033,7 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingCancelingRequests) { |
TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) { |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id())); |
EXPECT_EQ(0, |
@@ -1072,7 +1078,7 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) { |
TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) { |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
host_.BlockRequestsForRoute(filter_->child_id(), 1); |
host_.BlockRequestsForRoute(filter_->child_id(), 2); |
@@ -1171,7 +1177,7 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) { |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
// Saturate the number of outstanding requests for our process. |
for (size_t i = 0; i < kMaxRequests; ++i) { |
@@ -1556,7 +1562,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigation) { |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
int new_render_view_id = 1; |
int new_request_id = 2; |
@@ -1615,7 +1621,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
- this, browser_context_->GetResourceContext()); |
+ this, GetResourceContextForTest(browser_context_.get())); |
int new_render_view_id = 1; |
int new_request_id = 2; |