Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / prerender / prerender_tracker_unittest.cc
index 54b77a9..5fc302b 100644 (file)
@@ -19,9 +19,9 @@
 #include "content/public/browser/resource_controller.h"
 #include "content/public/browser/resource_request_info.h"
 #include "content/public/test/test_browser_thread.h"
-#include "content/test/net/url_request_mock_http_job.h"
 #include "ipc/ipc_message.h"
 #include "net/base/request_priority.h"
+#include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/redirect_info.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_test_util.h"
@@ -224,12 +224,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
   // Fake a request.
   net::TestURLRequestContext url_request_context;
   DeferredRedirectDelegate delegate;
-  net::URLRequest request(
-      content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+  scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
+      net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
       net::DEFAULT_PRIORITY,
       &delegate,
-      &url_request_context);
-  content::ResourceRequestInfo::AllocateForTesting(&request,
+      NULL));
+  content::ResourceRequestInfo::AllocateForTesting(request.get(),
                                                    content::RESOURCE_TYPE_IMAGE,
                                                    NULL,
                                                    kDefaultChildId,
@@ -238,11 +238,11 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
                                                    true);
 
   // Install a prerender throttle.
-  PrerenderResourceThrottle throttle(&request);
+  PrerenderResourceThrottle throttle(request.get());
   delegate.SetThrottle(&throttle);
 
   // Start the request and wait for a redirect.
-  request.Start();
+  request->Start();
   delegate.Run();
   EXPECT_TRUE(delegate.was_deferred());
   // This calls WillRedirectRequestOnUI().
@@ -267,13 +267,13 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
   // Fake a request.
   net::TestURLRequestContext url_request_context;
   DeferredRedirectDelegate delegate;
-  net::URLRequest request(
-      content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+  scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
+      net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
       net::DEFAULT_PRIORITY,
       &delegate,
-      &url_request_context);
+      NULL));
   content::ResourceRequestInfo::AllocateForTesting(
-      &request,
+      request.get(),
       content::RESOURCE_TYPE_MAIN_FRAME,
       NULL,
       kDefaultChildId,
@@ -282,12 +282,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
       true);
 
   // Install a prerender throttle.
-  PrerenderResourceThrottle throttle(&request);
+  PrerenderResourceThrottle throttle(request.get());
   delegate.SetThrottle(&throttle);
 
   // Start the request and wait for a redirect. This time, it should
   // not be deferred.
-  request.Start();
+  request->Start();
   delegate.Run();
   // This calls WillRedirectRequestOnUI().
   RunEvents();
@@ -309,12 +309,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
   // Fake a request.
   net::TestURLRequestContext url_request_context;
   DeferredRedirectDelegate delegate;
-  net::URLRequest request(
-      content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
+  scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
+      net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
       net::DEFAULT_PRIORITY,
       &delegate,
-      &url_request_context);
-  content::ResourceRequestInfo::AllocateForTesting(&request,
+      NULL));
+  content::ResourceRequestInfo::AllocateForTesting(request.get(),
                                                    content::RESOURCE_TYPE_XHR,
                                                    NULL,
                                                    kDefaultChildId,
@@ -323,11 +323,11 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
                                                    false);
 
   // Install a prerender throttle.
-  PrerenderResourceThrottle throttle(&request);
+  PrerenderResourceThrottle throttle(request.get());
   delegate.SetThrottle(&throttle);
 
   // Start the request and wait for a redirect.
-  request.Start();
+  request->Start();
   delegate.Run();
   // This calls WillRedirectRequestOnUI().
   RunEvents();