OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/drive/file_system.h" | 5 #include "components/drive/file_system.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Gets resource entry by path synchronously. | 171 // Gets resource entry by path synchronously. |
172 scoped_ptr<ResourceEntry> GetResourceEntrySync( | 172 scoped_ptr<ResourceEntry> GetResourceEntrySync( |
173 const base::FilePath& file_path) { | 173 const base::FilePath& file_path) { |
174 FileError error = FILE_ERROR_FAILED; | 174 FileError error = FILE_ERROR_FAILED; |
175 scoped_ptr<ResourceEntry> entry; | 175 scoped_ptr<ResourceEntry> entry; |
176 file_system_->GetResourceEntry( | 176 file_system_->GetResourceEntry( |
177 file_path, | 177 file_path, |
178 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 178 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
179 content::RunAllBlockingPoolTasksUntilIdle(); | 179 content::RunAllBlockingPoolTasksUntilIdle(); |
180 | 180 |
181 return entry.Pass(); | 181 return entry; |
182 } | 182 } |
183 | 183 |
184 // Gets directory info by path synchronously. | 184 // Gets directory info by path synchronously. |
185 scoped_ptr<ResourceEntryVector> ReadDirectorySync( | 185 scoped_ptr<ResourceEntryVector> ReadDirectorySync( |
186 const base::FilePath& file_path) { | 186 const base::FilePath& file_path) { |
187 FileError error = FILE_ERROR_FAILED; | 187 FileError error = FILE_ERROR_FAILED; |
188 scoped_ptr<ResourceEntryVector> entries(new ResourceEntryVector); | 188 scoped_ptr<ResourceEntryVector> entries(new ResourceEntryVector); |
189 file_system_->ReadDirectory( | 189 file_system_->ReadDirectory( |
190 file_path, | 190 file_path, |
191 base::Bind(&AccumulateReadDirectoryResult, entries.get()), | 191 base::Bind(&AccumulateReadDirectoryResult, entries.get()), |
192 google_apis::test_util::CreateCopyResultCallback(&error)); | 192 google_apis::test_util::CreateCopyResultCallback(&error)); |
193 content::RunAllBlockingPoolTasksUntilIdle(); | 193 content::RunAllBlockingPoolTasksUntilIdle(); |
194 if (error != FILE_ERROR_OK) | 194 if (error != FILE_ERROR_OK) |
195 entries.reset(); | 195 entries.reset(); |
196 return entries.Pass(); | 196 return entries; |
197 } | 197 } |
198 | 198 |
199 // Used to implement ReadDirectorySync(). | 199 // Used to implement ReadDirectorySync(). |
200 static void AccumulateReadDirectoryResult( | 200 static void AccumulateReadDirectoryResult( |
201 ResourceEntryVector* out_entries, | 201 ResourceEntryVector* out_entries, |
202 scoped_ptr<ResourceEntryVector> entries) { | 202 scoped_ptr<ResourceEntryVector> entries) { |
203 ASSERT_TRUE(entries); | 203 ASSERT_TRUE(entries); |
204 out_entries->insert(out_entries->end(), entries->begin(), entries->end()); | 204 out_entries->insert(out_entries->end(), entries->begin(), entries->end()); |
205 } | 205 } |
206 | 206 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 google_apis::test_util::CreateCopyResultCallback(&available)); | 1061 google_apis::test_util::CreateCopyResultCallback(&available)); |
1062 content::RunAllBlockingPoolTasksUntilIdle(); | 1062 content::RunAllBlockingPoolTasksUntilIdle(); |
1063 ASSERT_FALSE(available); | 1063 ASSERT_FALSE(available); |
1064 | 1064 |
1065 entry = GetResourceEntrySync(file_in_root); | 1065 entry = GetResourceEntrySync(file_in_root); |
1066 ASSERT_TRUE(entry); | 1066 ASSERT_TRUE(entry); |
1067 EXPECT_FALSE(entry->file_specific_info().cache_state().is_present()); | 1067 EXPECT_FALSE(entry->file_specific_info().cache_state().is_present()); |
1068 } | 1068 } |
1069 | 1069 |
1070 } // namespace drive | 1070 } // namespace drive |
OLD | NEW |