| 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/copy_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/task_runner_util.h" | 8 #include "base/task_runner_util.h" |
| 9 #include "chrome/browser/chromeos/drive/file_cache.h" | 9 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 10 #include "chrome/browser/chromeos/drive/file_change.h" | 10 #include "chrome/browser/chromeos/drive/file_change.h" |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 google_apis::test_util::CreateCopyResultCallback( | 478 google_apis::test_util::CreateCopyResultCallback( |
| 479 ©_error)); | 479 ©_error)); |
| 480 content::RunAllBlockingPoolTasksUntilIdle(); | 480 content::RunAllBlockingPoolTasksUntilIdle(); |
| 481 EXPECT_EQ(directory_local_id, waited_local_id); | 481 EXPECT_EQ(directory_local_id, waited_local_id); |
| 482 ASSERT_FALSE(pending_callback.is_null()); | 482 ASSERT_FALSE(pending_callback.is_null()); |
| 483 | 483 |
| 484 // Add a new directory to the server and store the resource ID locally. | 484 // Add a new directory to the server and store the resource ID locally. |
| 485 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR; | 485 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR; |
| 486 scoped_ptr<google_apis::FileResource> file_resource; | 486 scoped_ptr<google_apis::FileResource> file_resource; |
| 487 fake_service()->AddNewDirectory( | 487 fake_service()->AddNewDirectory( |
| 488 directory_parent.resource_id(), | 488 directory_parent.resource_id(), directory.title(), |
| 489 directory.title(), | 489 AddNewDirectoryOptions(), |
| 490 DriveServiceInterface::AddNewDirectoryOptions(), | 490 google_apis::test_util::CreateCopyResultCallback(&status, |
| 491 google_apis::test_util::CreateCopyResultCallback( | 491 &file_resource)); |
| 492 &status, &file_resource)); | |
| 493 content::RunAllBlockingPoolTasksUntilIdle(); | 492 content::RunAllBlockingPoolTasksUntilIdle(); |
| 494 EXPECT_EQ(google_apis::HTTP_CREATED, status); | 493 EXPECT_EQ(google_apis::HTTP_CREATED, status); |
| 495 ASSERT_TRUE(file_resource); | 494 ASSERT_TRUE(file_resource); |
| 496 | 495 |
| 497 directory.set_local_id(directory_local_id); | 496 directory.set_local_id(directory_local_id); |
| 498 directory.set_resource_id(file_resource->file_id()); | 497 directory.set_resource_id(file_resource->file_id()); |
| 499 base::PostTaskAndReplyWithResult( | 498 base::PostTaskAndReplyWithResult( |
| 500 blocking_task_runner(), | 499 blocking_task_runner(), |
| 501 FROM_HERE, | 500 FROM_HERE, |
| 502 base::Bind(&internal::ResourceMetadata::RefreshEntry, | 501 base::Bind(&internal::ResourceMetadata::RefreshEntry, |
| 503 base::Unretained(metadata()), directory), | 502 base::Unretained(metadata()), directory), |
| 504 google_apis::test_util::CreateCopyResultCallback(&error)); | 503 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 505 content::RunAllBlockingPoolTasksUntilIdle(); | 504 content::RunAllBlockingPoolTasksUntilIdle(); |
| 506 EXPECT_EQ(FILE_ERROR_OK, error); | 505 EXPECT_EQ(FILE_ERROR_OK, error); |
| 507 | 506 |
| 508 // Resume the copy operation. | 507 // Resume the copy operation. |
| 509 pending_callback.Run(FILE_ERROR_OK); | 508 pending_callback.Run(FILE_ERROR_OK); |
| 510 content::RunAllBlockingPoolTasksUntilIdle(); | 509 content::RunAllBlockingPoolTasksUntilIdle(); |
| 511 | 510 |
| 512 EXPECT_EQ(FILE_ERROR_OK, copy_error); | 511 EXPECT_EQ(FILE_ERROR_OK, copy_error); |
| 513 ResourceEntry entry; | 512 ResourceEntry entry; |
| 514 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &entry)); | 513 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &entry)); |
| 515 } | 514 } |
| 516 | 515 |
| 517 } // namespace file_system | 516 } // namespace file_system |
| 518 } // namespace drive | 517 } // namespace drive |
| OLD | NEW |