OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/drive/chromeos/fake_file_system.h" | 5 #include "components/drive/chromeos/fake_file_system.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 DCHECK(gdata_entry); | 310 DCHECK(gdata_entry); |
311 | 311 |
312 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); | 312 std::unique_ptr<ResourceEntry> entry(new ResourceEntry); |
313 std::string parent_resource_id; | 313 std::string parent_resource_id; |
314 bool converted = ConvertFileResourceToResourceEntry( | 314 bool converted = ConvertFileResourceToResourceEntry( |
315 *gdata_entry, entry.get(), &parent_resource_id); | 315 *gdata_entry, entry.get(), &parent_resource_id); |
316 DCHECK(converted); | 316 DCHECK(converted); |
317 entry->set_parent_local_id(parent_resource_id); | 317 entry->set_parent_local_id(parent_resource_id); |
318 | 318 |
319 base::FilePath cache_path = | 319 base::FilePath cache_path = |
320 cache_dir_.path().AppendASCII(entry->resource_id()); | 320 cache_dir_.GetPath().AppendASCII(entry->resource_id()); |
321 if (entry->file_specific_info().is_hosted_document()) { | 321 if (entry->file_specific_info().is_hosted_document()) { |
322 // For hosted documents return a dummy cache without server request. | 322 // For hosted documents return a dummy cache without server request. |
323 int result = base::WriteFile(cache_path, "", 0); | 323 int result = base::WriteFile(cache_path, "", 0); |
324 DCHECK_EQ(0, result); | 324 DCHECK_EQ(0, result); |
325 } | 325 } |
326 if (base::PathExists(cache_path)) { | 326 if (base::PathExists(cache_path)) { |
327 // Cache file is found. | 327 // Cache file is found. |
328 initialized_callback.Run(FILE_ERROR_OK, cache_path, std::move(entry)); | 328 initialized_callback.Run(FILE_ERROR_OK, cache_path, std::move(entry)); |
329 completion_callback.Run(FILE_ERROR_OK); | 329 completion_callback.Run(FILE_ERROR_OK); |
330 return; | 330 return; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 callback.Run(FILE_ERROR_OK, std::move(entry)); | 418 callback.Run(FILE_ERROR_OK, std::move(entry)); |
419 return; | 419 return; |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); | 423 callback.Run(FILE_ERROR_NOT_FOUND, std::unique_ptr<ResourceEntry>()); |
424 } | 424 } |
425 | 425 |
426 } // namespace test_util | 426 } // namespace test_util |
427 } // namespace drive | 427 } // namespace drive |
OLD | NEW |