Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc

Issue 23344004: Use CopyResourceOnServer to upload JSON GDoc file on Drive API v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/copy_operation.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/file_system/copy_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" 8 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
9 #include "chrome/browser/chromeos/drive/file_system_util.h" 9 #include "chrome/browser/chromeos/drive/file_system_util.h"
10 #include "chrome/browser/drive/drive_api_util.h"
10 #include "chrome/browser/drive/fake_drive_service.h" 11 #include "chrome/browser/drive/fake_drive_service.h"
11 #include "chrome/browser/google_apis/test_util.h" 12 #include "chrome/browser/google_apis/test_util.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace drive { 15 namespace drive {
15 namespace file_system { 16 namespace file_system {
16 17
17 class CopyOperationTest : public OperationTestBase { 18 class CopyOperationTest : public OperationTestBase {
18 protected: 19 protected:
19 virtual void SetUp() OVERRIDE { 20 virtual void SetUp() OVERRIDE {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 operation_->TransferFileFromLocalToRemote( 131 operation_->TransferFileFromLocalToRemote(
131 local_src_path, 132 local_src_path,
132 remote_dest_path, 133 remote_dest_path,
133 google_apis::test_util::CreateCopyResultCallback(&error)); 134 google_apis::test_util::CreateCopyResultCallback(&error));
134 test_util::RunBlockingPoolTask(); 135 test_util::RunBlockingPoolTask();
135 EXPECT_EQ(FILE_ERROR_OK, error); 136 EXPECT_EQ(FILE_ERROR_OK, error);
136 137
137 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry)); 138 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
138 139
139 // We added a file to the Drive root and then moved to "Directory 1". 140 // We added a file to the Drive root and then moved to "Directory 1".
140 EXPECT_EQ(2U, observer()->get_changed_paths().size()); 141 if (util::IsDriveV2ApiEnabled()) {
141 EXPECT_TRUE(observer()->get_changed_paths().count( 142 EXPECT_EQ(1U, observer()->get_changed_paths().size());
142 base::FilePath(FILE_PATH_LITERAL("drive/root")))); 143 EXPECT_TRUE(
143 EXPECT_TRUE(observer()->get_changed_paths().count( 144 observer()->get_changed_paths().count(remote_dest_path.DirName()));
144 remote_dest_path.DirName())); 145 } else {
146 EXPECT_EQ(2U, observer()->get_changed_paths().size());
147 EXPECT_TRUE(observer()->get_changed_paths().count(
148 base::FilePath(FILE_PATH_LITERAL("drive/root"))));
149 EXPECT_TRUE(observer()->get_changed_paths().count(
150 remote_dest_path.DirName()));
151 }
145 } 152 }
146 153
147 154
148 TEST_F(CopyOperationTest, CopyNotExistingFile) { 155 TEST_F(CopyOperationTest, CopyNotExistingFile) {
149 base::FilePath src_path(FILE_PATH_LITERAL("drive/root/Dummy file.txt")); 156 base::FilePath src_path(FILE_PATH_LITERAL("drive/root/Dummy file.txt"));
150 base::FilePath dest_path(FILE_PATH_LITERAL("drive/root/Test.log")); 157 base::FilePath dest_path(FILE_PATH_LITERAL("drive/root/Test.log"));
151 158
152 ResourceEntry entry; 159 ResourceEntry entry;
153 ASSERT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &entry)); 160 ASSERT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &entry));
154 161
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 test_util::RunBlockingPoolTask(); 212 test_util::RunBlockingPoolTask();
206 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error); 213 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error);
207 214
208 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry)); 215 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry));
209 EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry)); 216 EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
210 EXPECT_TRUE(observer()->get_changed_paths().empty()); 217 EXPECT_TRUE(observer()->get_changed_paths().empty());
211 } 218 }
212 219
213 } // namespace file_system 220 } // namespace file_system
214 } // namespace drive 221 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/copy_operation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698