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

Unified Diff: chrome/common/chrome_plugin_unittest.cc

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 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 | « chrome/common/appcache/chrome_appcache_service.h ('k') | chrome/test/testing_profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_plugin_unittest.cc
===================================================================
--- chrome/common/chrome_plugin_unittest.cc (revision 29872)
+++ chrome/common/chrome_plugin_unittest.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/browser/chrome_plugin_host.h"
+#include "chrome/browser/net/url_request_context_getter.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/test/chrome_plugin/test_chrome_plugin.h"
@@ -22,6 +23,17 @@
const char kPluginFilename[] = "test_chrome_plugin.dll";
const int kResponseBufferSize = 4096;
+class TestURLRequestContextGetter : public URLRequestContextGetter {
+ public:
+ virtual URLRequestContext* GetURLRequestContext() {
+ if (!context_)
+ context_ = new TestURLRequestContext();
+ return context_;
+ }
+ private:
+ scoped_refptr<URLRequestContext> context_;
+};
+
class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
public:
ChromePluginTest()
@@ -29,7 +41,7 @@
response_buffer_(new net::IOBuffer(kResponseBufferSize)),
plugin_(NULL),
expected_payload_(NULL),
- request_context_(new TestURLRequestContext()) {
+ request_context_getter_(new TestURLRequestContextGetter()) {
test_funcs_.test_make_request = NULL;
}
@@ -56,7 +68,7 @@
// We need to setup a default request context in order to issue HTTP
// requests.
DCHECK(!Profile::GetDefaultRequestContext());
- Profile::set_default_request_context(request_context_.get());
+ Profile::set_default_request_context(request_context_getter_.get());
}
virtual void TearDown() {
UnloadPlugin();
@@ -83,7 +95,7 @@
ChromePluginLib* plugin_;
TestFuncParams::PluginFuncs test_funcs_;
const TestResponsePayload* expected_payload_;
- scoped_refptr<URLRequestContext> request_context_;
+ scoped_refptr<URLRequestContextGetter> request_context_getter_;
};
static void STDCALL CPT_Complete(CPRequest* request, bool success,
« no previous file with comments | « chrome/common/appcache/chrome_appcache_service.h ('k') | chrome/test/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698