| 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/sync/entry_update_performer.h" | 5 #include "chrome/browser/chromeos/drive/sync/entry_update_performer.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/md5.h" | 9 #include "base/md5.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 namespace drive { | 23 namespace drive { |
| 24 namespace internal { | 24 namespace internal { |
| 25 | 25 |
| 26 class EntryUpdatePerformerTest : public file_system::OperationTestBase { | 26 class EntryUpdatePerformerTest : public file_system::OperationTestBase { |
| 27 protected: | 27 protected: |
| 28 virtual void SetUp() OVERRIDE { | 28 virtual void SetUp() OVERRIDE { |
| 29 OperationTestBase::SetUp(); | 29 OperationTestBase::SetUp(); |
| 30 performer_.reset(new EntryUpdatePerformer(blocking_task_runner(), | 30 performer_.reset(new EntryUpdatePerformer(blocking_task_runner(), |
| 31 observer(), | 31 delegate(), |
| 32 scheduler(), | 32 scheduler(), |
| 33 metadata(), | 33 metadata(), |
| 34 cache(), | 34 cache(), |
| 35 loader_controller())); | 35 loader_controller())); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Stores |content| to the cache and mark it as dirty. | 38 // Stores |content| to the cache and mark it as dirty. |
| 39 FileError StoreAndMarkDirty(const std::string& local_id, | 39 FileError StoreAndMarkDirty(const std::string& local_id, |
| 40 const std::string& content) { | 40 const std::string& content) { |
| 41 base::FilePath path; | 41 base::FilePath path; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 EXPECT_EQ(dest_entry.resource_id(), gdata_entry->parents()[0].file_id()); | 123 EXPECT_EQ(dest_entry.resource_id(), gdata_entry->parents()[0].file_id()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Tests updating metadata of a file with a non-dirty cache file. | 126 // Tests updating metadata of a file with a non-dirty cache file. |
| 127 TEST_F(EntryUpdatePerformerTest, UpdateEntry_WithNonDirtyCache) { | 127 TEST_F(EntryUpdatePerformerTest, UpdateEntry_WithNonDirtyCache) { |
| 128 base::FilePath src_path( | 128 base::FilePath src_path( |
| 129 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); | 129 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); |
| 130 | 130 |
| 131 // Download the file content to prepare a non-dirty cache file. | 131 // Download the file content to prepare a non-dirty cache file. |
| 132 file_system::DownloadOperation download_operation( | 132 file_system::DownloadOperation download_operation( |
| 133 blocking_task_runner(), observer(), scheduler(), metadata(), cache(), | 133 blocking_task_runner(), delegate(), scheduler(), metadata(), cache(), |
| 134 temp_dir()); | 134 temp_dir()); |
| 135 FileError error = FILE_ERROR_FAILED; | 135 FileError error = FILE_ERROR_FAILED; |
| 136 base::FilePath cache_file_path; | 136 base::FilePath cache_file_path; |
| 137 scoped_ptr<ResourceEntry> src_entry; | 137 scoped_ptr<ResourceEntry> src_entry; |
| 138 download_operation.EnsureFileDownloadedByPath( | 138 download_operation.EnsureFileDownloadedByPath( |
| 139 src_path, | 139 src_path, |
| 140 ClientContext(USER_INITIATED), | 140 ClientContext(USER_INITIATED), |
| 141 GetFileContentInitializedCallback(), | 141 GetFileContentInitializedCallback(), |
| 142 google_apis::GetContentCallback(), | 142 google_apis::GetContentCallback(), |
| 143 google_apis::test_util::CreateCopyResultCallback( | 143 google_apis::test_util::CreateCopyResultCallback( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 entry.resource_id(), | 546 entry.resource_id(), |
| 547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); | 547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); |
| 548 content::RunAllBlockingPoolTasksUntilIdle(); | 548 content::RunAllBlockingPoolTasksUntilIdle(); |
| 549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status); | 549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status); |
| 550 ASSERT_TRUE(server_entry); | 550 ASSERT_TRUE(server_entry); |
| 551 EXPECT_TRUE(server_entry->IsDirectory()); | 551 EXPECT_TRUE(server_entry->IsDirectory()); |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace internal | 554 } // namespace internal |
| 555 } // namespace drive | 555 } // namespace drive |
| OLD | NEW |