| Index: net/proxy/proxy_resolver_v8_tracing_unittest.cc
|
| diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc
|
| index fbca99f225f792e75e662510b5d23b585da1ca6e..125f5f9145cdafe32c00e75932f271ccc79d28b8 100644
|
| --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc
|
| +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc
|
| @@ -586,7 +586,7 @@ TEST_F(ProxyResolverV8TracingTest, CancelAll) {
|
|
|
| const size_t kNumRequests = 5;
|
| ProxyInfo proxy_info[kNumRequests];
|
| - ProxyResolver::RequestHandle request[kNumRequests];
|
| + scoped_ptr<ProxyResolver::Request> request[kNumRequests];
|
|
|
| for (size_t i = 0; i < kNumRequests; ++i) {
|
| resolver->GetProxyForURL(GURL("http://foo/"), &proxy_info[i],
|
| @@ -595,7 +595,7 @@ TEST_F(ProxyResolverV8TracingTest, CancelAll) {
|
| }
|
|
|
| for (size_t i = 0; i < kNumRequests; ++i) {
|
| - resolver->CancelRequest(request[i]);
|
| + request[i].reset();
|
| }
|
| }
|
|
|
| @@ -613,8 +613,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelSome) {
|
|
|
| ProxyInfo proxy_info1;
|
| ProxyInfo proxy_info2;
|
| - ProxyResolver::RequestHandle request1;
|
| - ProxyResolver::RequestHandle request2;
|
| + scoped_ptr<ProxyResolver::Request> request1;
|
| + scoped_ptr<ProxyResolver::Request> request2;
|
| TestCompletionCallback callback;
|
|
|
| resolver->GetProxyForURL(GURL("http://foo/"), &proxy_info1,
|
| @@ -624,7 +624,7 @@ TEST_F(ProxyResolverV8TracingTest, CancelSome) {
|
| callback.callback(), &request2,
|
| mock_bindings.CreateBindings());
|
|
|
| - resolver->CancelRequest(request1);
|
| + request1.reset();
|
|
|
| EXPECT_EQ(OK, callback.WaitForResult());
|
| }
|
| @@ -642,8 +642,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhilePendingCompletionTask) {
|
|
|
| ProxyInfo proxy_info1;
|
| ProxyInfo proxy_info2;
|
| - ProxyResolver::RequestHandle request1;
|
| - ProxyResolver::RequestHandle request2;
|
| + scoped_ptr<ProxyResolver::Request> request1;
|
| + scoped_ptr<ProxyResolver::Request> request2;
|
| TestCompletionCallback callback;
|
|
|
| resolver->GetProxyForURL(GURL("http://throw-an-error/"), &proxy_info1,
|
| @@ -653,9 +653,9 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhilePendingCompletionTask) {
|
| // Wait until the first request has finished running on the worker thread.
|
| // Cancel the first request, while it is running its completion task on
|
| // the origin thread.
|
| - mock_bindings.RunOnError(base::Bind(&ProxyResolverV8Tracing::CancelRequest,
|
| - base::Unretained(resolver.get()),
|
| - request1));
|
| + mock_bindings.RunOnError(
|
| + base::Bind(&scoped_ptr<ProxyResolver::Request>::reset,
|
| + base::Unretained(&request1), nullptr));
|
|
|
| // Start another request, to make sure it is able to complete.
|
| resolver->GetProxyForURL(GURL("http://i-have-no-idea-what-im-doing/"),
|
| @@ -745,8 +745,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileOutstandingNonBlockingDns) {
|
|
|
| ProxyInfo proxy_info1;
|
| ProxyInfo proxy_info2;
|
| - ProxyResolver::RequestHandle request1;
|
| - ProxyResolver::RequestHandle request2;
|
| + scoped_ptr<ProxyResolver::Request> request1;
|
| + scoped_ptr<ProxyResolver::Request> request2;
|
|
|
| resolver->GetProxyForURL(GURL("http://foo/req1"), &proxy_info1,
|
| base::Bind(&CrashCallback), &request1,
|
| @@ -760,8 +760,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileOutstandingNonBlockingDns) {
|
|
|
| host_resolver.WaitUntilRequestIsReceived();
|
|
|
| - resolver->CancelRequest(request1);
|
| - resolver->CancelRequest(request2);
|
| + request1.reset();
|
| + request2.reset();
|
|
|
| EXPECT_EQ(2, host_resolver.num_cancelled_requests());
|
|
|
| @@ -770,9 +770,8 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileOutstandingNonBlockingDns) {
|
| // should have been cancelled.
|
| }
|
|
|
| -void CancelRequestAndPause(ProxyResolverV8Tracing* resolver,
|
| - ProxyResolver::RequestHandle request) {
|
| - resolver->CancelRequest(request);
|
| +void CancelRequestAndPause(scoped_ptr<ProxyResolver::Request>* request) {
|
| + request->reset();
|
|
|
| // Sleep for a little bit. This makes it more likely for the worker
|
| // thread to have returned from its call, and serves as a regression
|
| @@ -791,14 +790,13 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileBlockedInNonBlockingDns) {
|
| CreateResolver(mock_bindings.CreateBindings(), "dns.js");
|
|
|
| ProxyInfo proxy_info;
|
| - ProxyResolver::RequestHandle request;
|
| + scoped_ptr<ProxyResolver::Request> request;
|
|
|
| resolver->GetProxyForURL(GURL("http://foo/"), &proxy_info,
|
| base::Bind(&CrashCallback), &request,
|
| mock_bindings.CreateBindings());
|
|
|
| - host_resolver.SetAction(
|
| - base::Bind(CancelRequestAndPause, resolver.get(), request));
|
| + host_resolver.SetAction(base::Bind(CancelRequestAndPause, &request));
|
|
|
| host_resolver.WaitUntilRequestIsReceived();
|
| }
|
| @@ -813,7 +811,7 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileBlockedInNonBlockingDns2) {
|
| CreateResolver(mock_bindings.CreateBindings(), "dns.js");
|
|
|
| ProxyInfo proxy_info;
|
| - ProxyResolver::RequestHandle request;
|
| + scoped_ptr<ProxyResolver::Request> request;
|
|
|
| resolver->GetProxyForURL(GURL("http://foo/"), &proxy_info,
|
| base::Bind(&CrashCallback), &request,
|
| @@ -823,7 +821,7 @@ TEST_F(ProxyResolverV8TracingTest, CancelWhileBlockedInNonBlockingDns2) {
|
| // work whatever the delay is here, but it is most useful if the delay
|
| // is large enough to allow a task to be posted back.
|
| base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
|
| - resolver->CancelRequest(request);
|
| + request.reset();
|
|
|
| EXPECT_EQ(0u, host_resolver.num_resolve());
|
| }
|
|
|