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

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

Issue 2133083002: Remove all remaining traces of MessageLoopProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 3436
3437 // Tests the dispatcher host's temporary file management. 3437 // Tests the dispatcher host's temporary file management.
3438 TEST_P(ResourceDispatcherHostTest, RegisterDownloadedTempFile) { 3438 TEST_P(ResourceDispatcherHostTest, RegisterDownloadedTempFile) {
3439 const int kRequestID = 1; 3439 const int kRequestID = 1;
3440 3440
3441 // Create a temporary file. 3441 // Create a temporary file.
3442 base::FilePath file_path; 3442 base::FilePath file_path;
3443 ASSERT_TRUE(base::CreateTemporaryFile(&file_path)); 3443 ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
3444 scoped_refptr<ShareableFileReference> deletable_file = 3444 scoped_refptr<ShareableFileReference> deletable_file =
3445 ShareableFileReference::GetOrCreate( 3445 ShareableFileReference::GetOrCreate(
3446 file_path, 3446 file_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
3447 ShareableFileReference::DELETE_ON_FINAL_RELEASE, 3447 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get());
3448 BrowserThread::GetMessageLoopProxyForThread(
3449 BrowserThread::FILE).get());
3450 3448
3451 // Not readable. 3449 // Not readable.
3452 EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 3450 EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
3453 filter_->child_id(), file_path)); 3451 filter_->child_id(), file_path));
3454 3452
3455 // Register it for a resource request. 3453 // Register it for a resource request.
3456 host_.RegisterDownloadedTempFile(filter_->child_id(), kRequestID, file_path); 3454 host_.RegisterDownloadedTempFile(filter_->child_id(), kRequestID, file_path);
3457 3455
3458 // Should be readable now. 3456 // Should be readable now.
3459 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 3457 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
(...skipping 23 matching lines...) Expand all
3483 // Tests that temporary files held on behalf of child processes are released 3481 // Tests that temporary files held on behalf of child processes are released
3484 // when the child process dies. 3482 // when the child process dies.
3485 TEST_P(ResourceDispatcherHostTest, ReleaseTemporiesOnProcessExit) { 3483 TEST_P(ResourceDispatcherHostTest, ReleaseTemporiesOnProcessExit) {
3486 const int kRequestID = 1; 3484 const int kRequestID = 1;
3487 3485
3488 // Create a temporary file. 3486 // Create a temporary file.
3489 base::FilePath file_path; 3487 base::FilePath file_path;
3490 ASSERT_TRUE(base::CreateTemporaryFile(&file_path)); 3488 ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
3491 scoped_refptr<ShareableFileReference> deletable_file = 3489 scoped_refptr<ShareableFileReference> deletable_file =
3492 ShareableFileReference::GetOrCreate( 3490 ShareableFileReference::GetOrCreate(
3493 file_path, 3491 file_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
3494 ShareableFileReference::DELETE_ON_FINAL_RELEASE, 3492 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get());
3495 BrowserThread::GetMessageLoopProxyForThread(
3496 BrowserThread::FILE).get());
3497 3493
3498 // Register it for a resource request. 3494 // Register it for a resource request.
3499 host_.RegisterDownloadedTempFile(filter_->child_id(), kRequestID, file_path); 3495 host_.RegisterDownloadedTempFile(filter_->child_id(), kRequestID, file_path);
3500 deletable_file = NULL; 3496 deletable_file = NULL;
3501 3497
3502 // Should be readable now. 3498 // Should be readable now.
3503 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 3499 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
3504 filter_->child_id(), file_path)); 3500 filter_->child_id(), file_path));
3505 3501
3506 // Let the process die. 3502 // Let the process die.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 return nullptr; 3895 return nullptr;
3900 } 3896 }
3901 3897
3902 INSTANTIATE_TEST_CASE_P( 3898 INSTANTIATE_TEST_CASE_P(
3903 ResourceDispatcherHostTests, 3899 ResourceDispatcherHostTests,
3904 ResourceDispatcherHostTest, 3900 ResourceDispatcherHostTest,
3905 testing::Values(TestConfig::kDefault, 3901 testing::Values(TestConfig::kDefault,
3906 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3902 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3907 3903
3908 } // namespace content 3904 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698