diff options
Diffstat (limited to 'content/browser/download')
-rw-r--r-- | content/browser/download/base_file_posix.cc | 2 | ||||
-rw-r--r-- | content/browser/download/base_file_unittest.cc | 32 | ||||
-rw-r--r-- | content/browser/download/base_file_win.cc | 2 | ||||
-rw-r--r-- | content/browser/download/download_browsertest.cc | 22 | ||||
-rw-r--r-- | content/browser/download/download_file_unittest.cc | 44 | ||||
-rw-r--r-- | content/browser/download/drag_download_util.cc | 2 | ||||
-rw-r--r-- | content/browser/download/save_file_manager.cc | 2 |
7 files changed, 53 insertions, 53 deletions
diff --git a/content/browser/download/base_file_posix.cc b/content/browser/download/base_file_posix.cc index 1900942..dd664af 100644 --- a/content/browser/download/base_file_posix.cc +++ b/content/browser/download/base_file_posix.cc @@ -17,7 +17,7 @@ DownloadInterruptReason BaseFile::MoveFileAndAdjustPermissions( struct stat st; // First check the file existence and create an empty file if it doesn't // exist. - if (!file_util::PathExists(new_path)) { + if (!base::PathExists(new_path)) { int write_error = file_util::WriteFile(new_path, "", 0); if (write_error < 0) return LogSystemError("WriteFile", errno); diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 8f37f59..415d756 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -79,7 +79,7 @@ class BaseFileTest : public testing::Test { // thread checks inside it. base_file_.reset(); - EXPECT_EQ(expect_file_survives_, file_util::PathExists(full_path)); + EXPECT_EQ(expect_file_survives_, base::PathExists(full_path)); } void ResetHash() { @@ -239,9 +239,9 @@ TEST_F(BaseFileTest, CreateDestroy) { // Cancel the download explicitly. TEST_F(BaseFileTest, Cancel) { ASSERT_TRUE(InitializeFile()); - EXPECT_TRUE(file_util::PathExists(base_file_->full_path())); + EXPECT_TRUE(base::PathExists(base_file_->full_path())); base_file_->Cancel(); - EXPECT_FALSE(file_util::PathExists(base_file_->full_path())); + EXPECT_FALSE(base::PathExists(base_file_->full_path())); EXPECT_NE(base::FilePath().value(), base_file_->full_path().value()); } @@ -284,15 +284,15 @@ TEST_F(BaseFileTest, WriteThenRenameAndDetach) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); base_file_->Finish(); base_file_->Detach(); @@ -422,16 +422,16 @@ TEST_F(BaseFileTest, WriteThenRename) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); base_file_->Finish(); } @@ -441,16 +441,16 @@ TEST_F(BaseFileTest, RenameWhileInProgress) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_TRUE(base_file_->in_progress()); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData2)); @@ -467,7 +467,7 @@ TEST_F(BaseFileTest, RenameWithError) { ASSERT_TRUE(file_util::CreateDirectory(test_dir)); base::FilePath new_path(test_dir.AppendASCII("TestFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); { file_util::PermissionRestorer restore_permissions_for(test_dir); diff --git a/content/browser/download/base_file_win.cc b/content/browser/download/base_file_win.cc index 449134e..398e5fc 100644 --- a/content/browser/download/base_file_win.cc +++ b/content/browser/download/base_file_win.cc @@ -339,7 +339,7 @@ DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { // If the file is still there, then the error could be due to AES not being // available or some other error during the AES invocation. In either case, // we don't surface the error to the user. - if (!file_util::PathExists(full_path_)) { + if (!base::PathExists(full_path_)) { DCHECK(FAILED(hr)); result = MapScanAndSaveErrorCodeToInterruptReason(hr); if (result == DOWNLOAD_INTERRUPT_REASON_NONE) { diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 2cc7cfd..cba13f0 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -664,7 +664,7 @@ class DownloadContentTest : public ContentBrowserTest { download->GetFullPath().BaseName().value()); EXPECT_EQ(file_exists, (!download->GetFullPath().empty() && - file_util::PathExists(download->GetFullPath()))); + base::PathExists(download->GetFullPath()))); if (file_exists) { std::string file_contents; @@ -1412,14 +1412,14 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelInterruptedDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); download->Cancel(true /* user_cancel */); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The intermediate file should now be gone. - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); EXPECT_TRUE(download->GetFullPath().empty()); } @@ -1444,14 +1444,14 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); download->Remove(); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The intermediate file should now be gone. - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); } // A completed download shouldn't delete the downloaded file when it is @@ -1467,13 +1467,13 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveDownload) { // The target path should exist. base::FilePath target_path(download->GetTargetFilePath()); - EXPECT_TRUE(file_util::PathExists(target_path)); + EXPECT_TRUE(base::PathExists(target_path)); download->Remove(); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The file should still exist. - EXPECT_TRUE(file_util::PathExists(target_path)); + EXPECT_TRUE(base::PathExists(target_path)); } } @@ -1502,7 +1502,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveResumingDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); // Resume and remove download. We expect only a single OnDownloadCreated() // call, and that's for the second download created below. @@ -1513,7 +1513,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveResumingDownload) { // The intermediate file should now be gone. RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); // Start the second download and wait until it's done. The test server is // single threaded. The response to this download request should follow the @@ -1549,7 +1549,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelResumingDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); // Resume and cancel download. We expect only a single OnDownloadCreated() // call, and that's for the second download created below. @@ -1560,7 +1560,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelResumingDownload) { // The intermediate file should now be gone. RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); EXPECT_TRUE(download->GetFullPath().empty()); // Start the second download and wait until it's done. The test server is diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 604baa4..3f8209b 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -340,7 +340,7 @@ const int DownloadFileTest::kDummyRequestId = 67; TEST_F(DownloadFileTest, RenameFileFinal) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); base::FilePath path_2(initial_path.InsertBeforeExtensionASCII("_2")); base::FilePath path_3(initial_path.InsertBeforeExtensionASCII("_3")); @@ -356,8 +356,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_1, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(path_1)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(path_1)); // Download the data. const char* chunks1[] = { kTestData1, kTestData2 }; @@ -371,8 +371,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_2, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_1)); - EXPECT_TRUE(file_util::PathExists(path_2)); + EXPECT_FALSE(base::PathExists(path_1)); + EXPECT_TRUE(base::PathExists(path_2)); const char* chunks2[] = { kTestData3 }; AppendDataToFile(chunks2, 1); @@ -385,8 +385,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_3, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_2)); - EXPECT_TRUE(file_util::PathExists(path_3)); + EXPECT_FALSE(base::PathExists(path_2)); + EXPECT_TRUE(base::PathExists(path_3)); // Should not be able to get the hash until the file is closed. std::string hash; @@ -402,8 +402,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_4, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_3)); - EXPECT_TRUE(file_util::PathExists(path_4)); + EXPECT_FALSE(base::PathExists(path_3)); + EXPECT_TRUE(base::PathExists(path_4)); // Check the hash. EXPECT_TRUE(download_file_->GetHash(&hash)); @@ -411,11 +411,11 @@ TEST_F(DownloadFileTest, RenameFileFinal) { // Check that a rename with overwrite to an existing file succeeds. std::string file_contents; - ASSERT_FALSE(file_util::PathExists(path_5)); + ASSERT_FALSE(base::PathExists(path_5)); static const char file_data[] = "xyzzy"; ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); - ASSERT_TRUE(file_util::PathExists(path_5)); + ASSERT_TRUE(base::PathExists(path_5)); EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); EXPECT_EQ(std::string(file_data), file_contents); @@ -435,18 +435,18 @@ TEST_F(DownloadFileTest, RenameFileFinal) { TEST_F(DownloadFileTest, RenameUniquifies) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); base::FilePath path_1_suffixed(path_1.InsertBeforeExtensionASCII(" (1)")); - ASSERT_FALSE(file_util::PathExists(path_1)); + ASSERT_FALSE(base::PathExists(path_1)); static const char file_data[] = "xyzzy"; ASSERT_EQ(static_cast<int>(sizeof(file_data)), file_util::WriteFile(path_1, file_data, sizeof(file_data))); - ASSERT_TRUE(file_util::PathExists(path_1)); + ASSERT_TRUE(base::PathExists(path_1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, RenameAndUniquify(path_1, NULL)); - EXPECT_TRUE(file_util::PathExists(path_1_suffixed)); + EXPECT_TRUE(base::PathExists(path_1_suffixed)); FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); loop_.RunUntilIdle(); @@ -467,8 +467,8 @@ TEST_F(DownloadFileTest, RenameError) { // Targets base::FilePath target_path_suffixed( target_path.InsertBeforeExtensionASCII(" (1)")); - ASSERT_FALSE(file_util::PathExists(target_path)); - ASSERT_FALSE(file_util::PathExists(target_path_suffixed)); + ASSERT_FALSE(base::PathExists(target_path)); + ASSERT_FALSE(base::PathExists(target_path_suffixed)); // Make the directory unwritable and try to rename within it. { @@ -479,7 +479,7 @@ TEST_F(DownloadFileTest, RenameError) { EXPECT_CALL(*input_stream_, RegisterCallback(IsNullCallback())); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, RenameAndAnnotate(target_path, NULL)); - EXPECT_FALSE(file_util::PathExists(target_path_suffixed)); + EXPECT_FALSE(base::PathExists(target_path_suffixed)); } FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); @@ -491,7 +491,7 @@ TEST_F(DownloadFileTest, RenameError) { TEST_F(DownloadFileTest, StreamEmptySuccess) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); // Test that calling the sink_callback_ on an empty stream shouldn't // do anything. @@ -509,7 +509,7 @@ TEST_F(DownloadFileTest, StreamEmptySuccess) { TEST_F(DownloadFileTest, StreamEmptyError) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); // Finish the download in error and make sure we see it on the // observer. @@ -536,7 +536,7 @@ TEST_F(DownloadFileTest, StreamEmptyError) { TEST_F(DownloadFileTest, StreamNonEmptySuccess) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); const char* chunks1[] = { kTestData1, kTestData2 }; ::testing::Sequence s1; @@ -552,7 +552,7 @@ TEST_F(DownloadFileTest, StreamNonEmptySuccess) { TEST_F(DownloadFileTest, StreamNonEmptyError) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); const char* chunks1[] = { kTestData1, kTestData2 }; ::testing::Sequence s1; diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc index a5ff841..41bff06 100644 --- a/content/browser/download/drag_download_util.cc +++ b/content/browser/download/drag_download_util.cc @@ -82,7 +82,7 @@ FileStream* CreateFileStreamForDrop(base::FilePath* file_path, // Explicitly (and redundantly check) for file -- despite the fact that our // open won't overwrite -- just to avoid log spew. - if (!file_util::PathExists(new_file_path) && + if (!base::PathExists(new_file_path) && file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE) == net::OK) { *file_path = new_file_path; diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc index 36ba5a1..3dab9d8 100644 --- a/content/browser/download/save_file_manager.cc +++ b/content/browser/download/save_file_manager.cc @@ -481,7 +481,7 @@ void SaveFileManager::RenameAllFiles( int save_package_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (!resource_dir.empty() && !file_util::PathExists(resource_dir)) + if (!resource_dir.empty() && !base::PathExists(resource_dir)) file_util::CreateDirectory(resource_dir); for (FinalNameList::const_iterator i = final_names.begin(); |