| 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/search_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/search_operation.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 8 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 9 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 9 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
| 10 #include "chrome/browser/drive/fake_drive_service.h" | 10 #include "chrome/browser/drive/fake_drive_service.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 TEST_F(SearchOperationTest, ContentSearchWithNewEntry) { | 51 TEST_F(SearchOperationTest, ContentSearchWithNewEntry) { |
| 52 SearchOperation operation(blocking_task_runner(), scheduler(), metadata(), | 52 SearchOperation operation(blocking_task_runner(), scheduler(), metadata(), |
| 53 loader_controller()); | 53 loader_controller()); |
| 54 | 54 |
| 55 // Create a new directory in the drive service. | 55 // Create a new directory in the drive service. |
| 56 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR; | 56 google_apis::DriveApiErrorCode status = google_apis::DRIVE_OTHER_ERROR; |
| 57 scoped_ptr<google_apis::FileResource> server_entry; | 57 scoped_ptr<google_apis::FileResource> server_entry; |
| 58 fake_service()->AddNewDirectory( | 58 fake_service()->AddNewDirectory( |
| 59 fake_service()->GetRootResourceId(), | 59 fake_service()->GetRootResourceId(), "New Directory 1!", |
| 60 "New Directory 1!", | 60 AddNewDirectoryOptions(), |
| 61 DriveServiceInterface::AddNewDirectoryOptions(), | |
| 62 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); | 61 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); |
| 63 content::RunAllBlockingPoolTasksUntilIdle(); | 62 content::RunAllBlockingPoolTasksUntilIdle(); |
| 64 ASSERT_EQ(google_apis::HTTP_CREATED, status); | 63 ASSERT_EQ(google_apis::HTTP_CREATED, status); |
| 65 | 64 |
| 66 // As the result of the first Search(), only entries in the current file | 65 // As the result of the first Search(), only entries in the current file |
| 67 // system snapshot are expected to be returned in the "right" path. New | 66 // system snapshot are expected to be returned in the "right" path. New |
| 68 // entries like "New Directory 1!" is temporarily added to "drive/other". | 67 // entries like "New Directory 1!" is temporarily added to "drive/other". |
| 69 std::set<std::string> expected_results; | 68 std::set<std::string> expected_results; |
| 70 expected_results.insert("drive/root/Directory 1"); | 69 expected_results.insert("drive/root/Directory 1"); |
| 71 expected_results.insert("drive/other/New Directory 1!"); | 70 expected_results.insert("drive/other/New Directory 1!"); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Unlock, this should resume the pending search. | 148 // Unlock, this should resume the pending search. |
| 150 lock.reset(); | 149 lock.reset(); |
| 151 content::RunAllBlockingPoolTasksUntilIdle(); | 150 content::RunAllBlockingPoolTasksUntilIdle(); |
| 152 EXPECT_EQ(FILE_ERROR_OK, error); | 151 EXPECT_EQ(FILE_ERROR_OK, error); |
| 153 ASSERT_TRUE(results); | 152 ASSERT_TRUE(results); |
| 154 EXPECT_EQ(1u, results->size()); | 153 EXPECT_EQ(1u, results->size()); |
| 155 } | 154 } |
| 156 | 155 |
| 157 } // namespace file_system | 156 } // namespace file_system |
| 158 } // namespace drive | 157 } // namespace drive |
| OLD | NEW |