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

Unified Diff: content/test/webrtc_audio_device_test.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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
Index: content/test/webrtc_audio_device_test.cc
diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc
index c9e72ec65134f46a2f3848054b61e22dfda45cc5..45325953580bc643741bea4b60c446529495840d 100644
--- a/content/test/webrtc_audio_device_test.cc
+++ b/content/test/webrtc_audio_device_test.cc
@@ -81,11 +81,34 @@ class ReplaceContentClientRenderer {
namespace {
+class MockResourceContext : public content::ResourceContext {
+ public:
+ MockResourceContext() : test_request_context_(NULL) {}
+ virtual ~MockResourceContext() {}
+
+ void set_request_context(net::URLRequestContext* request_context) {
+ test_request_context_ = request_context;
+ }
+
+ // ResourceContext implementation:
+ virtual net::HostResolver* GetHostResolver() OVERRIDE {
+ return NULL;
+ }
+ virtual net::URLRequestContext* GetRequestContext() OVERRIDE {
+ return test_request_context_;
+ }
+
+ private:
+ net::URLRequestContext* test_request_context_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockResourceContext);
+};
+
ACTION_P(QuitMessageLoop, loop_or_proxy) {
loop_or_proxy->PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
-} // end namespace
+} // namespace
WebRTCAudioDeviceTest::WebRTCAudioDeviceTest()
: render_thread_(NULL), audio_util_callback_(NULL),
@@ -106,7 +129,7 @@ void WebRTCAudioDeviceTest::SetUp() {
MessageLoop::current()));
// Construct the resource context on the UI thread.
- resource_context_.reset(new content::MockResourceContext(NULL));
+ resource_context_.reset(new MockResourceContext);
static const char kThreadName[] = "RenderThread";
ChildProcess::current()->io_message_loop()->PostTask(FROM_HERE,
@@ -168,8 +191,10 @@ void WebRTCAudioDeviceTest::InitializeIOThread(const char* thread_name) {
audio_manager_.reset(media::AudioManager::Create());
// Populate our resource context.
- test_request_context_ = new TestURLRequestContext();
- resource_context_->set_request_context(test_request_context_.get());
+ test_request_context_.reset(new TestURLRequestContext());
+ MockResourceContext* resource_context =
+ static_cast<MockResourceContext*>(resource_context_.get());
+ resource_context->set_request_context(test_request_context_.get());
media_observer_.reset(new MockMediaObserver());
has_input_devices_ = audio_manager_->HasAudioInputDevices();
@@ -183,7 +208,7 @@ void WebRTCAudioDeviceTest::UninitializeIOThread() {
resource_context_.reset();
audio_manager_.reset();
- test_request_context_ = NULL;
+ test_request_context_.reset();
initialize_com_.reset();
}
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698