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

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

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new tests Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 scoped_ptr<ResourceHandlerStub> leaf_handler, 306 scoped_ptr<ResourceHandlerStub> leaf_handler,
307 net::URLRequest* request) { 307 net::URLRequest* request) {
308 return leaf_handler.PassAs<ResourceHandler>(); 308 return leaf_handler.PassAs<ResourceHandler>();
309 } 309 }
310 310
311 virtual void SetUp() OVERRIDE { 311 virtual void SetUp() OVERRIDE {
312 const int kRenderProcessId = 1; 312 const int kRenderProcessId = 1;
313 const int kRenderViewId = 2; 313 const int kRenderViewId = 2;
314 314
315 scoped_ptr<net::URLRequest> request( 315 scoped_ptr<net::URLRequest> request(
316 new net::URLRequest(test_url(), 316 resource_context_.GetRequestContext()->CreateRequest(
317 net::DEFAULT_PRIORITY, 317 test_url(),
318 NULL, 318 net::DEFAULT_PRIORITY,
319 resource_context_.GetRequestContext())); 319 NULL /* delegate */,
320 NULL /* cookie_store */));
320 raw_ptr_to_request_ = request.get(); 321 raw_ptr_to_request_ = request.get();
321 ResourceRequestInfo::AllocateForTesting(request.get(), 322 ResourceRequestInfo::AllocateForTesting(request.get(),
322 RESOURCE_TYPE_MAIN_FRAME, 323 RESOURCE_TYPE_MAIN_FRAME,
323 &resource_context_, 324 &resource_context_,
324 kRenderProcessId, 325 kRenderProcessId,
325 kRenderViewId, 326 kRenderViewId,
326 MSG_ROUTING_NONE, 327 MSG_ROUTING_NONE,
327 false); 328 false);
328 scoped_ptr<ResourceHandlerStub> resource_handler( 329 scoped_ptr<ResourceHandlerStub> resource_handler(
329 new ResourceHandlerStub(request.get())); 330 new ResourceHandlerStub(request.get()));
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 ASSERT_TRUE(base::ReadFileToString(temp_path(), &contents)); 722 ASSERT_TRUE(base::ReadFileToString(temp_path(), &contents));
722 EXPECT_EQ(test_data(), contents); 723 EXPECT_EQ(test_data(), contents);
723 724
724 // Release the loader. The file should be gone now. 725 // Release the loader. The file should be gone now.
725 ReleaseLoader(); 726 ReleaseLoader();
726 base::RunLoop().RunUntilIdle(); 727 base::RunLoop().RunUntilIdle();
727 EXPECT_FALSE(base::PathExists(temp_path())); 728 EXPECT_FALSE(base::PathExists(temp_path()));
728 } 729 }
729 730
730 } // namespace content 731 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_unittest.cc ('k') | extensions/browser/extension_protocols_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698