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 "chrome/browser/chromeos/drive/fake_drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/fake_drive_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 DriveFileError error = util::GDataToDriveFileError(gdata_error); | 390 DriveFileError error = util::GDataToDriveFileError(gdata_error); |
391 if (error != DRIVE_FILE_OK) { | 391 if (error != DRIVE_FILE_OK) { |
392 callback.Run(error, scoped_ptr<DriveEntryProto>()); | 392 callback.Run(error, scoped_ptr<DriveEntryProto>()); |
393 return; | 393 return; |
394 } | 394 } |
395 | 395 |
396 DCHECK(resource_list); | 396 DCHECK(resource_list); |
397 const ScopedVector<google_apis::ResourceEntry>& entries = | 397 const ScopedVector<google_apis::ResourceEntry>& entries = |
398 resource_list->entries(); | 398 resource_list->entries(); |
399 for (size_t i = 0; i < entries.size(); ++i) { | 399 for (size_t i = 0; i < entries.size(); ++i) { |
400 const google_apis::ResourceEntry& entry = *entries[i]; | 400 scoped_ptr<DriveEntryProto> entry(new DriveEntryProto( |
401 if (base::FilePath(entry.title()) == base_name) { | 401 ConvertResourceEntryToDriveEntryProto(*entries[i]))); |
| 402 if (entry->base_name() == base_name.AsUTF8Unsafe()) { |
402 // Found the target entry. | 403 // Found the target entry. |
403 scoped_ptr<DriveEntryProto> entry_proto(new DriveEntryProto( | 404 callback.Run(DRIVE_FILE_OK, entry.Pass()); |
404 ConvertResourceEntryToDriveEntryProto(entry))); | |
405 callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); | |
406 return; | 405 return; |
407 } | 406 } |
408 } | 407 } |
409 | 408 |
410 callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, scoped_ptr<DriveEntryProto>()); | 409 callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, scoped_ptr<DriveEntryProto>()); |
411 } | 410 } |
412 | 411 |
413 } // namespace test_util | 412 } // namespace test_util |
414 } // namespace drive | 413 } // namespace drive |
OLD | NEW |