| 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/download_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/task_runner_util.h" | 8 #include "base/task_runner_util.h" |
| 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 10 #include "chrome/browser/chromeos/drive/file_cache.h" | 10 #include "chrome/browser/chromeos/drive/file_cache.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 // Try second download. In this case, the file should be cached, so | 350 // Try second download. In this case, the file should be cached, so |
| 351 // |local_path| should not be empty while |cancel_download| is empty. | 351 // |local_path| should not be empty while |cancel_download| is empty. |
| 352 EXPECT_EQ(FILE_ERROR_OK, initialized_error); | 352 EXPECT_EQ(FILE_ERROR_OK, initialized_error); |
| 353 ASSERT_TRUE(entry); | 353 ASSERT_TRUE(entry); |
| 354 ASSERT_TRUE(!local_path.empty()); | 354 ASSERT_TRUE(!local_path.empty()); |
| 355 EXPECT_TRUE(cancel_download.is_null()); | 355 EXPECT_TRUE(cancel_download.is_null()); |
| 356 // The content is available from the cache file. | 356 // The content is available from the cache file. |
| 357 EXPECT_TRUE(get_content_callback.data().empty()); | 357 EXPECT_TRUE(get_content_callback.data().empty()); |
| 358 int64 local_file_size = 0; | 358 int64 local_file_size = 0; |
| 359 file_util::GetFileSize(local_path, &local_file_size); | 359 base::GetFileSize(local_path, &local_file_size); |
| 360 EXPECT_EQ(entry->file_info().size(), local_file_size); | 360 EXPECT_EQ(entry->file_info().size(), local_file_size); |
| 361 EXPECT_EQ(FILE_ERROR_OK, completion_error); | 361 EXPECT_EQ(FILE_ERROR_OK, completion_error); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 | 364 |
| 365 TEST_F(DownloadOperationTest, EnsureFileDownloadedByLocalId_FromCache) { | 365 TEST_F(DownloadOperationTest, EnsureFileDownloadedByLocalId_FromCache) { |
| 366 base::FilePath temp_file; | 366 base::FilePath temp_file; |
| 367 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir(), &temp_file)); | 367 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir(), &temp_file)); |
| 368 | 368 |
| 369 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); | 369 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 test_util::RunBlockingPoolTask(); | 460 test_util::RunBlockingPoolTask(); |
| 461 | 461 |
| 462 EXPECT_EQ(FILE_ERROR_OK, error); | 462 EXPECT_EQ(FILE_ERROR_OK, error); |
| 463 // Check that the result of local modification is propagated. | 463 // Check that the result of local modification is propagated. |
| 464 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size()); | 464 EXPECT_EQ(static_cast<int64>(dirty_size), init_entry->file_info().size()); |
| 465 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size()); | 465 EXPECT_EQ(static_cast<int64>(dirty_size), entry->file_info().size()); |
| 466 } | 466 } |
| 467 | 467 |
| 468 } // namespace file_system | 468 } // namespace file_system |
| 469 } // namespace drive | 469 } // namespace drive |
| OLD | NEW |