OLD | NEW |
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/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 scoped_refptr<SiteInstance> site_instance = | 397 scoped_refptr<SiteInstance> site_instance = |
398 SiteInstance::Create(browser_context_.get()); | 398 SiteInstance::Create(browser_context_.get()); |
399 web_contents_.reset( | 399 web_contents_.reset( |
400 TestWebContents::Create(browser_context_.get(), site_instance.get())); | 400 TestWebContents::Create(browser_context_.get(), site_instance.get())); |
401 RenderFrameHost* rfh = web_contents_->GetMainFrame(); | 401 RenderFrameHost* rfh = web_contents_->GetMainFrame(); |
402 | 402 |
403 scoped_ptr<net::URLRequest> request( | 403 scoped_ptr<net::URLRequest> request( |
404 resource_context_.GetRequestContext()->CreateRequest( | 404 resource_context_.GetRequestContext()->CreateRequest( |
405 test_url(), | 405 test_url(), |
406 net::DEFAULT_PRIORITY, | 406 net::DEFAULT_PRIORITY, |
407 NULL /* delegate */, | 407 NULL /* delegate */)); |
408 NULL /* cookie_store */)); | |
409 raw_ptr_to_request_ = request.get(); | 408 raw_ptr_to_request_ = request.get(); |
410 ResourceRequestInfo::AllocateForTesting( | 409 ResourceRequestInfo::AllocateForTesting( |
411 request.get(), RESOURCE_TYPE_MAIN_FRAME, &resource_context_, | 410 request.get(), RESOURCE_TYPE_MAIN_FRAME, &resource_context_, |
412 rfh->GetProcess()->GetID(), rfh->GetRenderViewHost()->GetRoutingID(), | 411 rfh->GetProcess()->GetID(), rfh->GetRenderViewHost()->GetRoutingID(), |
413 rfh->GetRoutingID(), true /* is_main_frame */, | 412 rfh->GetRoutingID(), true /* is_main_frame */, |
414 false /* parent_is_main_frame */, true /* allow_download */, | 413 false /* parent_is_main_frame */, true /* allow_download */, |
415 false /* is_async */); | 414 false /* is_async */); |
416 scoped_ptr<ResourceHandlerStub> resource_handler( | 415 scoped_ptr<ResourceHandlerStub> resource_handler( |
417 new ResourceHandlerStub(request.get())); | 416 new ResourceHandlerStub(request.get())); |
418 raw_ptr_resource_handler_ = resource_handler.get(); | 417 raw_ptr_resource_handler_ = resource_handler.get(); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 ASSERT_TRUE(base::ReadFileToString(temp_path(), &contents)); | 884 ASSERT_TRUE(base::ReadFileToString(temp_path(), &contents)); |
886 EXPECT_EQ(test_data(), contents); | 885 EXPECT_EQ(test_data(), contents); |
887 | 886 |
888 // Release the loader. The file should be gone now. | 887 // Release the loader. The file should be gone now. |
889 ReleaseLoader(); | 888 ReleaseLoader(); |
890 base::RunLoop().RunUntilIdle(); | 889 base::RunLoop().RunUntilIdle(); |
891 EXPECT_FALSE(base::PathExists(temp_path())); | 890 EXPECT_FALSE(base::PathExists(temp_path())); |
892 } | 891 } |
893 | 892 |
894 } // namespace content | 893 } // namespace content |
OLD | NEW |