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

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

Issue 13149003: drive: Use "/drive/root" namespace and fix Files app and tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittests fixed. Created 7 years, 8 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
OLDNEW
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/file_system/create_directory_operation.h " 5 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h "
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/browser/chromeos/drive/change_list_loader.h" 9 #include "chrome/browser/chromeos/drive/change_list_loader.h"
10 #include "chrome/browser/chromeos/drive/drive_cache.h" 10 #include "chrome/browser/chromeos/drive/drive_cache.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 scoped_ptr<CreateDirectoryOperation> operation_; 134 scoped_ptr<CreateDirectoryOperation> operation_;
135 }; 135 };
136 136
137 TEST_F(CreateDirectoryOperationTest, FindFirstMissingParentDirectory) { 137 TEST_F(CreateDirectoryOperationTest, FindFirstMissingParentDirectory) {
138 ASSERT_TRUE(LoadRootFeedDocument("chromeos/gdata/root_feed.json")); 138 ASSERT_TRUE(LoadRootFeedDocument("chromeos/gdata/root_feed.json"));
139 139
140 CreateDirectoryOperation::FindFirstMissingParentDirectoryResult result; 140 CreateDirectoryOperation::FindFirstMissingParentDirectoryResult result;
141 141
142 // Create directory in root. 142 // Create directory in root.
143 base::FilePath dir_path(FILE_PATH_LITERAL("drive/New Folder 1")); 143 base::FilePath dir_path(FILE_PATH_LITERAL("drive/root/New Folder 1"));
144 operation()->FindFirstMissingParentDirectory( 144 operation()->FindFirstMissingParentDirectory(
145 dir_path, 145 dir_path,
146 google_apis::test_util::CreateCopyResultCallback(&result)); 146 google_apis::test_util::CreateCopyResultCallback(&result));
147 google_apis::test_util::RunBlockingPoolTask(); 147 google_apis::test_util::RunBlockingPoolTask();
148 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error); 148 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error);
149 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive/New Folder 1")), 149 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive/root/New Folder 1")),
150 result.first_missing_parent_path); 150 result.first_missing_parent_path);
151 EXPECT_EQ("fake_root", result.last_dir_resource_id); 151 EXPECT_EQ("fake_root", result.last_dir_resource_id);
152 152
153 // Missing folders in subdir of an existing folder. 153 // Missing folders in subdir of an existing folder.
154 base::FilePath dir_path2(FILE_PATH_LITERAL("drive/Directory 1/New Folder 2")); 154 base::FilePath dir_path2(
155 FILE_PATH_LITERAL("drive/root/Directory 1/New Folder 2"));
155 operation()->FindFirstMissingParentDirectory( 156 operation()->FindFirstMissingParentDirectory(
156 dir_path2, 157 dir_path2,
157 google_apis::test_util::CreateCopyResultCallback(&result)); 158 google_apis::test_util::CreateCopyResultCallback(&result));
158 google_apis::test_util::RunBlockingPoolTask(); 159 google_apis::test_util::RunBlockingPoolTask();
159 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error); 160 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error);
160 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1/New Folder 2")), 161 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL(
162 "drive/root/Directory 1/New Folder 2")),
161 result.first_missing_parent_path); 163 result.first_missing_parent_path);
162 EXPECT_NE("fake_root", result.last_dir_resource_id); // non-root dir. 164 EXPECT_NE("fake_root", result.last_dir_resource_id); // non-root dir.
163 165
164 // Missing two folders on the path. 166 // Missing two folders on the path.
165 base::FilePath dir_path3 = 167 base::FilePath dir_path3 =
166 dir_path2.Append(FILE_PATH_LITERAL("Another Folder")); 168 dir_path2.Append(FILE_PATH_LITERAL("Another Folder"));
167 operation()->FindFirstMissingParentDirectory( 169 operation()->FindFirstMissingParentDirectory(
168 dir_path3, 170 dir_path3,
169 google_apis::test_util::CreateCopyResultCallback(&result)); 171 google_apis::test_util::CreateCopyResultCallback(&result));
170 google_apis::test_util::RunBlockingPoolTask(); 172 google_apis::test_util::RunBlockingPoolTask();
171 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error); 173 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_MISSING, result.error);
172 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1/New Folder 2")), 174 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL(
175 "drive/root/Directory 1/New Folder 2")),
173 result.first_missing_parent_path); 176 result.first_missing_parent_path);
174 EXPECT_NE("fake_root", result.last_dir_resource_id); // non-root dir. 177 EXPECT_NE("fake_root", result.last_dir_resource_id); // non-root dir.
175 178
176 // Folders on top of an existing file. 179 // Folders on top of an existing file.
177 operation()->FindFirstMissingParentDirectory( 180 operation()->FindFirstMissingParentDirectory(
178 base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt/BadDir")), 181 base::FilePath(FILE_PATH_LITERAL("drive/root/File 1.txt/BadDir")),
179 google_apis::test_util::CreateCopyResultCallback(&result)); 182 google_apis::test_util::CreateCopyResultCallback(&result));
180 google_apis::test_util::RunBlockingPoolTask(); 183 google_apis::test_util::RunBlockingPoolTask();
181 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_INVALID, result.error); 184 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_FOUND_INVALID, result.error);
182 185
183 // Existing folder. 186 // Existing folder.
184 operation()->FindFirstMissingParentDirectory( 187 operation()->FindFirstMissingParentDirectory(
185 base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")), 188 base::FilePath(FILE_PATH_LITERAL("drive/root/Directory 1")),
186 google_apis::test_util::CreateCopyResultCallback(&result)); 189 google_apis::test_util::CreateCopyResultCallback(&result));
187 google_apis::test_util::RunBlockingPoolTask(); 190 google_apis::test_util::RunBlockingPoolTask();
188 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_DIRECTORY_ALREADY_PRESENT, 191 EXPECT_EQ(CreateDirectoryOperation::FIND_FIRST_DIRECTORY_ALREADY_PRESENT,
189 result.error); 192 result.error);
190 } 193 }
191 194
192 } // namespace file_system 195 } // namespace file_system
193 } // namespace drive 196 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698