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 "chrome/browser/drive/fake_drive_service.h" | 5 #include "chrome/browser/drive/fake_drive_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 // Go through entries and copy the one that matches |resource_id|. | 774 // Go through entries and copy the one that matches |resource_id|. |
775 if (resource_list_value_->GetList("entry", &entries)) { | 775 if (resource_list_value_->GetList("entry", &entries)) { |
776 for (size_t i = 0; i < entries->GetSize(); ++i) { | 776 for (size_t i = 0; i < entries->GetSize(); ++i) { |
777 base::DictionaryValue* entry = NULL; | 777 base::DictionaryValue* entry = NULL; |
778 std::string current_resource_id; | 778 std::string current_resource_id; |
779 if (entries->GetDictionary(i, &entry) && | 779 if (entries->GetDictionary(i, &entry) && |
780 entry->GetString("gd$resourceId.$t", ¤t_resource_id) && | 780 entry->GetString("gd$resourceId.$t", ¤t_resource_id) && |
781 resource_id == current_resource_id) { | 781 resource_id == current_resource_id) { |
782 // Make a copy and set the new resource ID and the new title. | 782 // Make a copy and set the new resource ID and the new title. |
783 scoped_ptr<base::DictionaryValue> copied_entry(entry->DeepCopy()); | 783 scoped_ptr<base::DictionaryValue> copied_entry(entry->DeepCopy()); |
784 copied_entry->SetString("gd$resourceId.$t", | 784 copied_entry->SetString("gd$resourceId.$t", GetNewResourceId()); |
785 resource_id + "_copied"); | |
kinaba
2014/01/16 03:16:31
This old code breaks test that copies the same fil
| |
786 copied_entry->SetString("title.$t", new_title); | 785 copied_entry->SetString("title.$t", new_title); |
787 | 786 |
788 // Reset parent directory. | 787 // Reset parent directory. |
789 base::ListValue* links = NULL; | 788 base::ListValue* links = NULL; |
790 if (!copied_entry->GetList("link", &links)) { | 789 if (!copied_entry->GetList("link", &links)) { |
791 links = new base::ListValue; | 790 links = new base::ListValue; |
792 copied_entry->Set("link", links); | 791 copied_entry->Set("link", links); |
793 } | 792 } |
794 links->Clear(); | 793 links->Clear(); |
795 | 794 |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1732 FROM_HERE, | 1731 FROM_HERE, |
1733 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); | 1732 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); |
1734 } | 1733 } |
1735 | 1734 |
1736 GURL FakeDriveService::GetNewUploadSessionUrl() { | 1735 GURL FakeDriveService::GetNewUploadSessionUrl() { |
1737 return GURL("https://upload_session_url/" + | 1736 return GURL("https://upload_session_url/" + |
1738 base::Int64ToString(next_upload_sequence_number_++)); | 1737 base::Int64ToString(next_upload_sequence_number_++)); |
1739 } | 1738 } |
1740 | 1739 |
1741 } // namespace drive | 1740 } // namespace drive |
OLD | NEW |