Index: chrome/browser/extensions/user_script_listener_unittest.cc |
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc |
index 7279d56ff1c5468f4badc409cb46055bc59360c6..4154fd8e39c03ee3866338d2c0537b95b8a1697b 100644 |
--- a/chrome/browser/extensions/user_script_listener_unittest.cc |
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc |
@@ -4,6 +4,7 @@ |
#include "base/files/file_util.h" |
#include "base/json/json_file_value_serializer.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/threading/thread.h" |
#include "chrome/browser/chrome_notification_types.h" |
@@ -160,19 +161,21 @@ class UserScriptListenerTest : public ExtensionServiceTestBase { |
} |
protected: |
- net::TestURLRequest* StartTestRequest(net::URLRequest::Delegate* delegate, |
- const std::string& url_string, |
- net::TestURLRequestContext* context) { |
+ scoped_ptr<net::URLRequest> StartTestRequest( |
pauljensen
2014/08/28 15:48:39
I like the change to use a scoped_ptr instead of a
|
+ net::URLRequest::Delegate* delegate, |
+ const std::string& url_string, |
+ net::TestURLRequestContext* context) { |
GURL url(url_string); |
- net::TestURLRequest* request = |
- new net::TestURLRequest(url, net::DEFAULT_PRIORITY, delegate, context); |
+ scoped_ptr<net::URLRequest> request(context->CreateRequest( |
+ url, net::DEFAULT_PRIORITY, delegate, NULL)); |
ResourceThrottle* throttle = listener_->CreateResourceThrottle( |
url, content::RESOURCE_TYPE_MAIN_FRAME); |
bool defer = false; |
if (throttle) { |
- request->SetUserData(NULL, new ThrottleController(request, throttle)); |
+ request->SetUserData(NULL, |
+ new ThrottleController(request.get(), throttle)); |
throttle->WillStartRequest(&defer); |
} |
@@ -180,7 +183,7 @@ class UserScriptListenerTest : public ExtensionServiceTestBase { |
if (!defer) |
request->Start(); |
- return request; |
+ return request.Pass(); |
} |
void LoadTestExtension() { |
@@ -212,7 +215,7 @@ TEST_F(UserScriptListenerTest, DelayAndUpdate) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
- scoped_ptr<net::TestURLRequest> request( |
+ scoped_ptr<net::URLRequest> request( |
StartTestRequest(&delegate, kMatchingUrl, &context)); |
ASSERT_FALSE(request->is_pending()); |
@@ -230,7 +233,7 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
- scoped_ptr<net::TestURLRequest> request( |
+ scoped_ptr<net::URLRequest> request( |
StartTestRequest(&delegate, kMatchingUrl, &context)); |
ASSERT_FALSE(request->is_pending()); |
@@ -252,7 +255,7 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { |
TEST_F(UserScriptListenerTest, NoDelayNoExtension) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
- scoped_ptr<net::TestURLRequest> request( |
+ scoped_ptr<net::URLRequest> request( |
StartTestRequest(&delegate, kMatchingUrl, &context)); |
// The request should be started immediately. |
@@ -268,9 +271,8 @@ TEST_F(UserScriptListenerTest, NoDelayNotMatching) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
- scoped_ptr<net::TestURLRequest> request(StartTestRequest(&delegate, |
- kNotMatchingUrl, |
- &context)); |
+ scoped_ptr<net::URLRequest> request( |
+ StartTestRequest(&delegate, kNotMatchingUrl, &context)); |
// The request should be started immediately. |
ASSERT_TRUE(request->is_pending()); |
@@ -300,7 +302,7 @@ TEST_F(UserScriptListenerTest, MultiProfile) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
- scoped_ptr<net::TestURLRequest> request( |
+ scoped_ptr<net::URLRequest> request( |
StartTestRequest(&delegate, kMatchingUrl, &context)); |
ASSERT_FALSE(request->is_pending()); |
@@ -332,8 +334,8 @@ TEST_F(UserScriptListenerTest, ResumeBeforeStart) { |
net::TestDelegate delegate; |
net::TestURLRequestContext context; |
GURL url(kMatchingUrl); |
- scoped_ptr<net::TestURLRequest> request( |
- new net::TestURLRequest(url, net::DEFAULT_PRIORITY, &delegate, &context)); |
+ scoped_ptr<net::URLRequest> request(context.CreateRequest( |
+ url, net::DEFAULT_PRIORITY, &delegate, NULL)); |
ResourceThrottle* throttle = |
listener_->CreateResourceThrottle(url, content::RESOURCE_TYPE_MAIN_FRAME); |