Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: content/browser/renderer_host/resource_dispatcher_host_unittest.cc

Issue 10891016: Remove all callers of Profile::GetResourceContext(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/resource_context_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/resource_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698