Index: net/proxy/proxy_script_fetcher_impl_unittest.cc |
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc |
index 45fcc075c148b73e18f36bc1dc1f1c7c93d8a692..dd95e7e83a027e72a09486c29d3d5956c14b92ef 100644 |
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc |
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc |
@@ -96,10 +96,10 @@ class RequestContext : public URLRequestContext { |
new CheckNoRevocationFlagSetInterceptor); |
} |
- private: |
- ~RequestContext() { |
+ virtual ~RequestContext() { |
} |
+ private: |
URLRequestContextStorage storage_; |
scoped_ptr<URLRequestJobFactory> url_request_job_factory_; |
}; |
@@ -197,22 +197,17 @@ class ProxyScriptFetcherImplTest : public PlatformTest { |
: test_server_(TestServer::TYPE_HTTP, |
net::TestServer::kLocalhost, |
FilePath(kDocRoot)) { |
- } |
- |
- // testing::Test overrides |
- virtual void SetUp() OVERRIDE { |
- context_ = new RequestContext; |
- context_->set_network_delegate(&network_delegate_); |
+ context_.set_network_delegate(&network_delegate_); |
} |
protected: |
TestServer test_server_; |
BasicNetworkDelegate network_delegate_; |
- scoped_refptr<URLRequestContext> context_; |
+ RequestContext context_; |
}; |
TEST_F(ProxyScriptFetcherImplTest, FileUrl) { |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
{ // Fetch a non-existent file. |
string16 text; |
@@ -239,7 +234,7 @@ TEST_F(ProxyScriptFetcherImplTest, FileUrl) { |
TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
{ // Fetch a PAC with mime type "text/plain" |
GURL url(test_server_.GetURL("files/pac.txt")); |
@@ -273,7 +268,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { |
TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
{ // Fetch a PAC which gives a 500 -- FAIL |
GURL url(test_server_.GetURL("files/500.pac")); |
@@ -298,7 +293,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { |
TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Fetch PAC scripts via HTTP with a Content-Disposition header -- should |
// have no effect. |
@@ -314,7 +309,7 @@ TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { |
TEST_F(ProxyScriptFetcherImplTest, NoCache) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Fetch a PAC script whose HTTP headers make it cacheable for 1 hour. |
GURL url(test_server_.GetURL("files/cacheable_1hr.pac")); |
@@ -345,7 +340,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { |
TEST_F(ProxyScriptFetcherImplTest, TooLarge) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Set the maximum response size to 50 bytes. |
int prev_size = pac_fetcher.SetSizeConstraint(50); |
@@ -385,7 +380,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { |
TEST_F(ProxyScriptFetcherImplTest, Hang) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Set the timeout period to 0.5 seconds. |
base::TimeDelta prev_timeout = pac_fetcher.SetTimeoutConstraint( |
@@ -393,7 +388,8 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { |
// Try fetching a URL which takes 1.2 seconds. We should abort the request |
// after 500 ms, and fail with a timeout error. |
- { GURL url(test_server_.GetURL("slow/proxy.pac?1.2")); |
+ { |
+ GURL url(test_server_.GetURL("slow/proxy.pac?1.2")); |
string16 text; |
TestCompletionCallback callback; |
int result = pac_fetcher.Fetch(url, &text, callback.callback()); |
@@ -422,7 +418,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { |
TEST_F(ProxyScriptFetcherImplTest, Encodings) { |
ASSERT_TRUE(test_server_.Start()); |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
// Test a response that is gzip-encoded -- should get inflated. |
{ |
@@ -449,7 +445,7 @@ TEST_F(ProxyScriptFetcherImplTest, Encodings) { |
} |
TEST_F(ProxyScriptFetcherImplTest, DataURLs) { |
- ProxyScriptFetcherImpl pac_fetcher(context_.get()); |
+ ProxyScriptFetcherImpl pac_fetcher(&context_); |
const char kEncodedUrl[] = |
"data:application/x-ns-proxy-autoconfig;base64,ZnVuY3Rpb24gRmluZFByb3h5R" |