summaryrefslogtreecommitdiffstats
path: root/chrome/browser/drive
diff options
context:
space:
mode:
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 08:24:23 +0000
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 08:24:23 +0000
commit9bd5b28fb75e8054deacf9285ffc2810636a05dc (patch)
tree44c51a2bd5d7c8ce64c7a6f7d61c77bb1d3e4631 /chrome/browser/drive
parentd7a2d89aee556017139f6bea76e328423e60277d (diff)
downloadchromium_src-9bd5b28fb75e8054deacf9285ffc2810636a05dc.zip
chromium_src-9bd5b28fb75e8054deacf9285ffc2810636a05dc.tar.gz
chromium_src-9bd5b28fb75e8054deacf9285ffc2810636a05dc.tar.bz2
Fix FakeDriveService::CopyResource.
CopyResource wrongly overwrote the original entry data. This CL fixes it. BUG=240160 TEST=Ran unit_tests Review URL: https://chromiumcodereview.appspot.com/23079004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/drive')
-rw-r--r--chrome/browser/drive/fake_drive_service.cc4
-rw-r--r--chrome/browser/drive/fake_drive_service_unittest.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc
index 5fc49e3..7af31aa 100644
--- a/chrome/browser/drive/fake_drive_service.cc
+++ b/chrome/browser/drive/fake_drive_service.cc
@@ -742,9 +742,9 @@ CancelCallback FakeDriveService::CopyResource(
// Reset parent directory.
base::ListValue* links = NULL;
- if (!entry->GetList("link", &links)) {
+ if (!copied_entry->GetList("link", &links)) {
links = new base::ListValue;
- entry->Set("link", links);
+ copied_entry->Set("link", links);
}
links->Clear();
diff --git a/chrome/browser/drive/fake_drive_service_unittest.cc b/chrome/browser/drive/fake_drive_service_unittest.cc
index 51fdce5..0e7ce36 100644
--- a/chrome/browser/drive/fake_drive_service_unittest.cc
+++ b/chrome/browser/drive/fake_drive_service_unittest.cc
@@ -967,7 +967,7 @@ TEST_F(FakeDriveServiceTest, CopyResource) {
int64 old_largest_change_id = GetLargestChangeByAboutResource();
const std::string kResourceId = "file:2_file_resource_id";
- const std::string kParentResourceId = "folder:1_folder_resource_id";
+ const std::string kParentResourceId = "folder:2_folder_resource_id";
GDataErrorCode error = GDATA_OTHER_ERROR;
scoped_ptr<ResourceEntry> resource_entry;
fake_service_.CopyResource(
@@ -982,7 +982,7 @@ TEST_F(FakeDriveServiceTest, CopyResource) {
// The copied entry should have the new resource ID and the title.
EXPECT_EQ(kResourceId + "_copied", resource_entry->resource_id());
EXPECT_EQ("new title", resource_entry->title());
- EXPECT_TRUE(HasParent(kResourceId, kParentResourceId));
+ EXPECT_TRUE(HasParent(resource_entry->resource_id(), kParentResourceId));
// Should be incremented as a new hosted document was created.
EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());