| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kChild))); | 233 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kChild))); |
| 234 | 234 |
| 235 // Start syncing the kParent directory. | 235 // Start syncing the kParent directory. |
| 236 sync_status()->StartSyncing(URL(kParent)); | 236 sync_status()->StartSyncing(URL(kParent)); |
| 237 | 237 |
| 238 // Copying kDir to other directory should succeed, while moving would fail | 238 // Copying kDir to other directory should succeed, while moving would fail |
| 239 // (since the source directory is in syncing). | 239 // (since the source directory is in syncing). |
| 240 ResetCallbackStatus(); | 240 ResetCallbackStatus(); |
| 241 file_system_.operation_runner()->Copy( | 241 file_system_.operation_runner()->Copy( |
| 242 URL(kDir), URL("dest-copy"), | 242 URL(kDir), URL("dest-copy"), |
| 243 fileapi::FileSystemOperationRunner::CopyProgressCallback(), |
| 243 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 244 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 244 file_system_.operation_runner()->Move( | 245 file_system_.operation_runner()->Move( |
| 245 URL(kDir), URL("dest-move"), | 246 URL(kDir), URL("dest-move"), |
| 246 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 247 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 247 base::MessageLoop::current()->RunUntilIdle(); | 248 base::MessageLoop::current()->RunUntilIdle(); |
| 248 EXPECT_EQ(1, callback_count_); | 249 EXPECT_EQ(1, callback_count_); |
| 249 | 250 |
| 250 // Only "dest-copy1" should exist. | 251 // Only "dest-copy1" should exist. |
| 251 EXPECT_EQ(base::PLATFORM_FILE_OK, | 252 EXPECT_EQ(base::PLATFORM_FILE_OK, |
| 252 file_system_.DirectoryExists(URL("dest-copy"))); | 253 file_system_.DirectoryExists(URL("dest-copy"))); |
| 253 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, | 254 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
| 254 file_system_.DirectoryExists(URL("dest-move"))); | 255 file_system_.DirectoryExists(URL("dest-move"))); |
| 255 | 256 |
| 256 // Start syncing the "dest-copy2" directory. | 257 // Start syncing the "dest-copy2" directory. |
| 257 sync_status()->StartSyncing(URL("dest-copy2")); | 258 sync_status()->StartSyncing(URL("dest-copy2")); |
| 258 | 259 |
| 259 // Now the destination is also locked copying kDir should be queued. | 260 // Now the destination is also locked copying kDir should be queued. |
| 260 ResetCallbackStatus(); | 261 ResetCallbackStatus(); |
| 261 file_system_.operation_runner()->Copy( | 262 file_system_.operation_runner()->Copy( |
| 262 URL(kDir), URL("dest-copy2"), | 263 URL(kDir), URL("dest-copy2"), |
| 264 fileapi::FileSystemOperationRunner::CopyProgressCallback(), |
| 263 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 265 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 264 base::MessageLoop::current()->RunUntilIdle(); | 266 base::MessageLoop::current()->RunUntilIdle(); |
| 265 EXPECT_EQ(0, callback_count_); | 267 EXPECT_EQ(0, callback_count_); |
| 266 | 268 |
| 267 // Finish syncing the "dest-copy2" directory to unlock Copy. | 269 // Finish syncing the "dest-copy2" directory to unlock Copy. |
| 268 sync_status()->EndSyncing(URL("dest-copy2")); | 270 sync_status()->EndSyncing(URL("dest-copy2")); |
| 269 ResetCallbackStatus(); | 271 ResetCallbackStatus(); |
| 270 base::MessageLoop::current()->RunUntilIdle(); | 272 base::MessageLoop::current()->RunUntilIdle(); |
| 271 EXPECT_EQ(1, callback_count_); | 273 EXPECT_EQ(1, callback_count_); |
| 272 | 274 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 file_system_.operation_runner()->Truncate( | 389 file_system_.operation_runner()->Truncate( |
| 388 URL(kFile), 10, | 390 URL(kFile), 10, |
| 389 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 391 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 390 file_system_.operation_runner()->Cancel( | 392 file_system_.operation_runner()->Cancel( |
| 391 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); | 393 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_INVALID_OPERATION)); |
| 392 base::MessageLoop::current()->RunUntilIdle(); | 394 base::MessageLoop::current()->RunUntilIdle(); |
| 393 EXPECT_EQ(2, callback_count_); | 395 EXPECT_EQ(2, callback_count_); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace sync_file_system | 398 } // namespace sync_file_system |
| OLD | NEW |