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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job_unittest.cc

Issue 1271733002: [2/3 chromium] Support redirect option of Request and "opaqueredirect" response type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add _MODE to avoid compile error at Windows. Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (job_ && job_->ShouldFallbackToNetwork()) { 76 if (job_ && job_->ShouldFallbackToNetwork()) {
77 // Simulate fallback to network by constructing a valid response. 77 // Simulate fallback to network by constructing a valid response.
78 return new net::URLRequestTestJob(request, network_delegate, 78 return new net::URLRequestTestJob(request, network_delegate,
79 net::URLRequestTestJob::test_headers(), 79 net::URLRequestTestJob::test_headers(),
80 "PASS", true); 80 "PASS", true);
81 } 81 }
82 82
83 job_ = new ServiceWorkerURLRequestJob( 83 job_ = new ServiceWorkerURLRequestJob(
84 request, network_delegate, provider_host_, blob_storage_context_, 84 request, network_delegate, provider_host_, blob_storage_context_,
85 resource_context_, FETCH_REQUEST_MODE_NO_CORS, 85 resource_context_, FETCH_REQUEST_MODE_NO_CORS,
86 FETCH_CREDENTIALS_MODE_OMIT, true /* is_main_resource_load */, 86 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE,
87 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, 87 true /* is_main_resource_load */, REQUEST_CONTEXT_TYPE_HYPERLINK,
88 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL,
88 scoped_refptr<ResourceRequestBody>()); 89 scoped_refptr<ResourceRequestBody>());
89 job_->ForwardToServiceWorker(); 90 job_->ForwardToServiceWorker();
90 return job_; 91 return job_;
91 } 92 }
92 93
93 private: 94 private:
94 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; 95 base::WeakPtr<ServiceWorkerProviderHost> provider_host_;
95 const ResourceContext* resource_context_; 96 const ResourceContext* resource_context_;
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 97 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
97 mutable ServiceWorkerURLRequestJob* job_; 98 mutable ServiceWorkerURLRequestJob* job_;
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 base::RunLoop().RunUntilIdle(); 652 base::RunLoop().RunUntilIdle();
652 EXPECT_TRUE(request_->status().is_success()); 653 EXPECT_TRUE(request_->status().is_success());
653 EXPECT_EQ(200, request_->GetResponseCode()); 654 EXPECT_EQ(200, request_->GetResponseCode());
654 EXPECT_EQ("", url_request_delegate_.response_data()); 655 EXPECT_EQ("", url_request_delegate_.response_data());
655 } 656 }
656 657
657 // TODO(kinuko): Add more tests with different response data and also for 658 // TODO(kinuko): Add more tests with different response data and also for
658 // FallbackToNetwork case. 659 // FallbackToNetwork case.
659 660
660 } // namespace content 661 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698