| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 EXPECT_EQ(2, callback_count_); | 348 EXPECT_EQ(2, callback_count_); |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Test if CopyInForeignFile runs cooperatively with other Sync operations. | 351 // Test if CopyInForeignFile runs cooperatively with other Sync operations. |
| 352 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { | 352 TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) { |
| 353 const std::string kTestData("test data"); | 353 const std::string kTestData("test data"); |
| 354 | 354 |
| 355 base::FilePath temp_path; | 355 base::FilePath temp_path; |
| 356 ASSERT_TRUE(CreateTempFile(&temp_path)); | 356 ASSERT_TRUE(CreateTempFile(&temp_path)); |
| 357 ASSERT_EQ(static_cast<int>(kTestData.size()), | 357 ASSERT_EQ(static_cast<int>(kTestData.size()), |
| 358 file_util::WriteFile( | 358 base::WriteFile( |
| 359 temp_path, kTestData.data(), kTestData.size())); | 359 temp_path, kTestData.data(), kTestData.size())); |
| 360 | 360 |
| 361 sync_status()->StartSyncing(URL(kFile)); | 361 sync_status()->StartSyncing(URL(kFile)); |
| 362 ASSERT_FALSE(sync_status()->IsWritable(URL(kFile))); | 362 ASSERT_FALSE(sync_status()->IsWritable(URL(kFile))); |
| 363 | 363 |
| 364 // The URL is in syncing so CopyIn (which is a write operation) won't run. | 364 // The URL is in syncing so CopyIn (which is a write operation) won't run. |
| 365 ResetCallbackStatus(); | 365 ResetCallbackStatus(); |
| 366 file_system_.operation_runner()->CopyInForeignFile( | 366 file_system_.operation_runner()->CopyInForeignFile( |
| 367 temp_path, URL(kFile), | 367 temp_path, URL(kFile), |
| 368 ExpectStatus(FROM_HERE, File::FILE_OK)); | 368 ExpectStatus(FROM_HERE, File::FILE_OK)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 file_system_.operation_runner()->Truncate( | 400 file_system_.operation_runner()->Truncate( |
| 401 URL(kFile), 10, | 401 URL(kFile), 10, |
| 402 ExpectStatus(FROM_HERE, File::FILE_OK)); | 402 ExpectStatus(FROM_HERE, File::FILE_OK)); |
| 403 file_system_.operation_runner()->Cancel( | 403 file_system_.operation_runner()->Cancel( |
| 404 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); | 404 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); |
| 405 base::MessageLoop::current()->RunUntilIdle(); | 405 base::MessageLoop::current()->RunUntilIdle(); |
| 406 EXPECT_EQ(2, callback_count_); | 406 EXPECT_EQ(2, callback_count_); |
| 407 } | 407 } |
| 408 | 408 |
| 409 } // namespace sync_file_system | 409 } // namespace sync_file_system |
| OLD | NEW |