| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/drive/file_system/truncate_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/truncate_operation.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 9 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 base::FilePath local_path; | 107 base::FilePath local_path; |
| 108 error = FILE_ERROR_FAILED; | 108 error = FILE_ERROR_FAILED; |
| 109 cache()->GetFileOnUIThread( | 109 cache()->GetFileOnUIThread( |
| 110 GetLocalId(file_in_root), | 110 GetLocalId(file_in_root), |
| 111 google_apis::test_util::CreateCopyResultCallback(&error, &local_path)); | 111 google_apis::test_util::CreateCopyResultCallback(&error, &local_path)); |
| 112 test_util::RunBlockingPoolTask(); | 112 test_util::RunBlockingPoolTask(); |
| 113 ASSERT_EQ(FILE_ERROR_OK, error); | 113 ASSERT_EQ(FILE_ERROR_OK, error); |
| 114 | 114 |
| 115 // The local file should be truncated. | 115 // The local file should be truncated. |
| 116 std::string content; | 116 std::string content; |
| 117 ASSERT_TRUE(file_util::ReadFileToString(local_path, &content)); | 117 ASSERT_TRUE(base::ReadFileToString(local_path, &content)); |
| 118 | 118 |
| 119 EXPECT_EQ(file_size + 10, static_cast<int64>(content.size())); | 119 EXPECT_EQ(file_size + 10, static_cast<int64>(content.size())); |
| 120 // All trailing 10 bytes should be '\0'. | 120 // All trailing 10 bytes should be '\0'. |
| 121 EXPECT_EQ(std::string(10, '\0'), content.substr(file_size)); | 121 EXPECT_EQ(std::string(10, '\0'), content.substr(file_size)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace file_system | 124 } // namespace file_system |
| 125 } // namespace drive | 125 } // namespace drive |
| OLD | NEW |