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

Side by Side Diff: content/browser/loader/navigation_url_loader_unittest.cc

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 5 years, 2 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
(...skipping 16 matching lines...) Expand all
27 #include "net/base/load_flags.h" 27 #include "net/base/load_flags.h"
28 #include "net/base/net_errors.h" 28 #include "net/base/net_errors.h"
29 #include "net/http/http_response_headers.h" 29 #include "net/http/http_response_headers.h"
30 #include "net/url_request/redirect_info.h" 30 #include "net/url_request/redirect_info.h"
31 #include "net/url_request/url_request.h" 31 #include "net/url_request/url_request.h"
32 #include "net/url_request/url_request_context.h" 32 #include "net/url_request/url_request_context.h"
33 #include "net/url_request/url_request_job_factory_impl.h" 33 #include "net/url_request/url_request_job_factory_impl.h"
34 #include "net/url_request/url_request_test_job.h" 34 #include "net/url_request/url_request_test_job.h"
35 #include "net/url_request/url_request_test_util.h" 35 #include "net/url_request/url_request_test_util.h"
36 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
37 #include "url/origin.h"
37 38
38 namespace content { 39 namespace content {
39 40
40 namespace { 41 namespace {
41 42
42 class StreamProtocolHandler 43 class StreamProtocolHandler
43 : public net::URLRequestJobFactory::ProtocolHandler { 44 : public net::URLRequestJobFactory::ProtocolHandler {
44 public: 45 public:
45 StreamProtocolHandler(StreamRegistry* registry) : registry_(registry) {} 46 StreamProtocolHandler(StreamRegistry* registry) : registry_(registry) {}
46 47
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 177 }
177 178
178 scoped_ptr<NavigationURLLoader> MakeTestLoader( 179 scoped_ptr<NavigationURLLoader> MakeTestLoader(
179 const GURL& url, 180 const GURL& url,
180 NavigationURLLoaderDelegate* delegate) { 181 NavigationURLLoaderDelegate* delegate) {
181 BeginNavigationParams begin_params("GET", std::string(), net::LOAD_NORMAL, 182 BeginNavigationParams begin_params("GET", std::string(), net::LOAD_NORMAL,
182 false, false, 183 false, false,
183 REQUEST_CONTEXT_TYPE_LOCATION); 184 REQUEST_CONTEXT_TYPE_LOCATION);
184 CommonNavigationParams common_params; 185 CommonNavigationParams common_params;
185 common_params.url = url; 186 common_params.url = url;
186 scoped_ptr<NavigationRequestInfo> request_info( 187 scoped_ptr<NavigationRequestInfo> request_info(new NavigationRequestInfo(
187 new NavigationRequestInfo(common_params, begin_params, url, true, false, 188 common_params, begin_params, url, url::Origin(url), true, false, -1,
188 -1, scoped_refptr<ResourceRequestBody>())); 189 scoped_refptr<ResourceRequestBody>()));
189 190
190 return NavigationURLLoader::Create(browser_context_.get(), 191 return NavigationURLLoader::Create(browser_context_.get(),
191 request_info.Pass(), delegate); 192 request_info.Pass(), delegate);
192 } 193 }
193 194
194 // Helper function for fetching the body of a URL to a string. 195 // Helper function for fetching the body of a URL to a string.
195 std::string FetchURL(const GURL& url) { 196 std::string FetchURL(const GURL& url) {
196 net::TestDelegate delegate; 197 net::TestDelegate delegate;
197 net::URLRequestContext* request_context = 198 net::URLRequestContext* request_context =
198 browser_context_->GetResourceContext()->GetRequestContext(); 199 browser_context_->GetResourceContext()->GetRequestContext();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 396
396 // Release the body. 397 // Release the body.
397 delegate.ReleaseBody(); 398 delegate.ReleaseBody();
398 base::RunLoop().RunUntilIdle(); 399 base::RunLoop().RunUntilIdle();
399 400
400 // Verify that URLRequestTestJob no longer has anything paused. 401 // Verify that URLRequestTestJob no longer has anything paused.
401 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); 402 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage());
402 } 403 }
403 404
404 } // namespace content 405 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698