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

Side by Side Diff: chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc

Issue 11106007: drive: Rename 'gdata' namespace to 'drive' in chrome/browser/chromeos/drive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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) 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/chromeos/drive/drive_resource_metadata.h" 5 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "chrome/browser/chromeos/drive/drive.pb.h" 16 #include "chrome/browser/chromeos/drive/drive.pb.h"
17 #include "chrome/browser/chromeos/drive/drive_cache.h" 17 #include "chrome/browser/chromeos/drive/drive_cache.h"
18 #include "chrome/browser/chromeos/drive/drive_files.h" 18 #include "chrome/browser/chromeos/drive/drive_files.h"
19 #include "chrome/browser/chromeos/drive/drive_test_util.h" 19 #include "chrome/browser/chromeos/drive/drive_test_util.h"
20 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
21 #include "content/public/test/test_browser_thread.h" 21 #include "content/public/test/test_browser_thread.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace gdata { 24 namespace drive {
25 namespace { 25 namespace {
26 26
27 // See drive.proto for the difference between the two URLs. 27 // See drive.proto for the difference between the two URLs.
28 const char kResumableEditMediaUrl[] = "http://resumable-edit-media/"; 28 const char kResumableEditMediaUrl[] = "http://resumable-edit-media/";
29 const char kResumableCreateMediaUrl[] = "http://resumable-create-media/"; 29 const char kResumableCreateMediaUrl[] = "http://resumable-create-media/";
30 30
31 // Callback for DriveResourceMetadata::InitFromDB. 31 // Callback for DriveResourceMetadata::InitFromDB.
32 void InitFromDBCallback(DriveFileError expected_error, 32 void InitFromDBCallback(DriveFileError expected_error,
33 DriveFileError actual_error) { 33 DriveFileError actual_error) {
34 EXPECT_EQ(expected_error, actual_error); 34 EXPECT_EQ(expected_error, actual_error);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { 175 TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) {
176 // Confirm that an existing file is found. 176 // Confirm that an existing file is found.
177 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 177 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
178 FilePath drive_file_path; 178 FilePath drive_file_path;
179 scoped_ptr<DriveEntryProto> entry_proto; 179 scoped_ptr<DriveEntryProto> entry_proto;
180 resource_metadata_.GetEntryInfoByResourceId( 180 resource_metadata_.GetEntryInfoByResourceId(
181 "file_resource_id:file4", 181 "file_resource_id:file4",
182 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 182 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
183 &error, &drive_file_path, &entry_proto)); 183 &error, &drive_file_path, &entry_proto));
184 test_util::RunBlockingPoolTask(); 184 gdata::test_util::RunBlockingPoolTask();
185 EXPECT_EQ(DRIVE_FILE_OK, error); 185 EXPECT_EQ(DRIVE_FILE_OK, error);
186 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); 186 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path);
187 ASSERT_TRUE(entry_proto.get()); 187 ASSERT_TRUE(entry_proto.get());
188 EXPECT_EQ("file4", entry_proto->base_name()); 188 EXPECT_EQ("file4", entry_proto->base_name());
189 189
190 // Confirm that a non existing file is not found. 190 // Confirm that a non existing file is not found.
191 error = DRIVE_FILE_ERROR_FAILED; 191 error = DRIVE_FILE_ERROR_FAILED;
192 entry_proto.reset(); 192 entry_proto.reset();
193 resource_metadata_.GetEntryInfoByResourceId( 193 resource_metadata_.GetEntryInfoByResourceId(
194 "file:non_existing", 194 "file:non_existing",
195 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 195 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
196 &error, &drive_file_path, &entry_proto)); 196 &error, &drive_file_path, &entry_proto));
197 test_util::RunBlockingPoolTask(); 197 gdata::test_util::RunBlockingPoolTask();
198 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 198 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
199 EXPECT_FALSE(entry_proto.get()); 199 EXPECT_FALSE(entry_proto.get());
200 } 200 }
201 201
202 TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { 202 TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) {
203 // Confirm that an existing file is found. 203 // Confirm that an existing file is found.
204 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 204 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
205 scoped_ptr<DriveEntryProto> entry_proto; 205 scoped_ptr<DriveEntryProto> entry_proto;
206 resource_metadata_.GetEntryInfoByPath( 206 resource_metadata_.GetEntryInfoByPath(
207 FilePath::FromUTF8Unsafe("drive/dir1/file4"), 207 FilePath::FromUTF8Unsafe("drive/dir1/file4"),
208 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, 208 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
209 &error, &entry_proto)); 209 &error, &entry_proto));
210 test_util::RunBlockingPoolTask(); 210 gdata::test_util::RunBlockingPoolTask();
211 EXPECT_EQ(DRIVE_FILE_OK, error); 211 EXPECT_EQ(DRIVE_FILE_OK, error);
212 ASSERT_TRUE(entry_proto.get()); 212 ASSERT_TRUE(entry_proto.get());
213 EXPECT_EQ("file4", entry_proto->base_name()); 213 EXPECT_EQ("file4", entry_proto->base_name());
214 214
215 // Confirm that a non existing file is not found. 215 // Confirm that a non existing file is not found.
216 error = DRIVE_FILE_ERROR_FAILED; 216 error = DRIVE_FILE_ERROR_FAILED;
217 entry_proto.reset(); 217 entry_proto.reset();
218 resource_metadata_.GetEntryInfoByPath( 218 resource_metadata_.GetEntryInfoByPath(
219 FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), 219 FilePath::FromUTF8Unsafe("drive/dir1/non_existing"),
220 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, 220 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
221 &error, &entry_proto)); 221 &error, &entry_proto));
222 test_util::RunBlockingPoolTask(); 222 gdata::test_util::RunBlockingPoolTask();
223 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 223 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
224 EXPECT_FALSE(entry_proto.get()); 224 EXPECT_FALSE(entry_proto.get());
225 } 225 }
226 226
227 TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { 227 TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) {
228 // Confirm that an existing directory is found. 228 // Confirm that an existing directory is found.
229 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 229 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
230 scoped_ptr<DriveEntryProtoVector> entries; 230 scoped_ptr<DriveEntryProtoVector> entries;
231 resource_metadata_.ReadDirectoryByPath( 231 resource_metadata_.ReadDirectoryByPath(
232 FilePath::FromUTF8Unsafe("drive/dir1"), 232 FilePath::FromUTF8Unsafe("drive/dir1"),
233 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 233 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
234 &error, &entries)); 234 &error, &entries));
235 test_util::RunBlockingPoolTask(); 235 gdata::test_util::RunBlockingPoolTask();
236 EXPECT_EQ(DRIVE_FILE_OK, error); 236 EXPECT_EQ(DRIVE_FILE_OK, error);
237 ASSERT_TRUE(entries.get()); 237 ASSERT_TRUE(entries.get());
238 ASSERT_EQ(3U, entries->size()); 238 ASSERT_EQ(3U, entries->size());
239 239
240 // The order is not guaranteed so we should sort the base names. 240 // The order is not guaranteed so we should sort the base names.
241 std::vector<std::string> base_names; 241 std::vector<std::string> base_names;
242 for (size_t i = 0; i < 3; ++i) 242 for (size_t i = 0; i < 3; ++i)
243 base_names.push_back(entries->at(i).base_name()); 243 base_names.push_back(entries->at(i).base_name());
244 std::sort(base_names.begin(), base_names.end()); 244 std::sort(base_names.begin(), base_names.end());
245 245
246 EXPECT_EQ("dir3", base_names[0]); 246 EXPECT_EQ("dir3", base_names[0]);
247 EXPECT_EQ("file4", base_names[1]); 247 EXPECT_EQ("file4", base_names[1]);
248 EXPECT_EQ("file5", base_names[2]); 248 EXPECT_EQ("file5", base_names[2]);
249 249
250 // Confirm that a non existing directory is not found. 250 // Confirm that a non existing directory is not found.
251 error = DRIVE_FILE_ERROR_FAILED; 251 error = DRIVE_FILE_ERROR_FAILED;
252 entries.reset(); 252 entries.reset();
253 resource_metadata_.ReadDirectoryByPath( 253 resource_metadata_.ReadDirectoryByPath(
254 FilePath::FromUTF8Unsafe("drive/non_existing"), 254 FilePath::FromUTF8Unsafe("drive/non_existing"),
255 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 255 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
256 &error, &entries)); 256 &error, &entries));
257 test_util::RunBlockingPoolTask(); 257 gdata::test_util::RunBlockingPoolTask();
258 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 258 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
259 EXPECT_FALSE(entries.get()); 259 EXPECT_FALSE(entries.get());
260 260
261 // Confirm that reading a file results in DRIVE_FILE_ERROR_NOT_A_DIRECTORY. 261 // Confirm that reading a file results in DRIVE_FILE_ERROR_NOT_A_DIRECTORY.
262 error = DRIVE_FILE_ERROR_FAILED; 262 error = DRIVE_FILE_ERROR_FAILED;
263 entries.reset(); 263 entries.reset();
264 resource_metadata_.ReadDirectoryByPath( 264 resource_metadata_.ReadDirectoryByPath(
265 FilePath::FromUTF8Unsafe("drive/dir1/file4"), 265 FilePath::FromUTF8Unsafe("drive/dir1/file4"),
266 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 266 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
267 &error, &entries)); 267 &error, &entries));
268 test_util::RunBlockingPoolTask(); 268 gdata::test_util::RunBlockingPoolTask();
269 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); 269 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error);
270 EXPECT_FALSE(entries.get()); 270 EXPECT_FALSE(entries.get());
271 } 271 }
272 272
273 TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { 273 TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) {
274 // Confirm that existing two files are found. 274 // Confirm that existing two files are found.
275 scoped_ptr<EntryInfoPairResult> pair_result; 275 scoped_ptr<EntryInfoPairResult> pair_result;
276 resource_metadata_.GetEntryInfoPairByPaths( 276 resource_metadata_.GetEntryInfoPairByPaths(
277 FilePath::FromUTF8Unsafe("drive/dir1/file4"), 277 FilePath::FromUTF8Unsafe("drive/dir1/file4"),
278 FilePath::FromUTF8Unsafe("drive/dir1/file5"), 278 FilePath::FromUTF8Unsafe("drive/dir1/file5"),
279 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, 279 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback,
280 &pair_result)); 280 &pair_result));
281 test_util::RunBlockingPoolTask(); 281 gdata::test_util::RunBlockingPoolTask();
282 // The first entry should be found. 282 // The first entry should be found.
283 EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); 283 EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error);
284 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), 284 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"),
285 pair_result->first.path); 285 pair_result->first.path);
286 ASSERT_TRUE(pair_result->first.proto.get()); 286 ASSERT_TRUE(pair_result->first.proto.get());
287 EXPECT_EQ("file4", pair_result->first.proto->base_name()); 287 EXPECT_EQ("file4", pair_result->first.proto->base_name());
288 // The second entry should be found. 288 // The second entry should be found.
289 EXPECT_EQ(DRIVE_FILE_OK, pair_result->second.error); 289 EXPECT_EQ(DRIVE_FILE_OK, pair_result->second.error);
290 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file5"), 290 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file5"),
291 pair_result->second.path); 291 pair_result->second.path);
292 ASSERT_TRUE(pair_result->second.proto.get()); 292 ASSERT_TRUE(pair_result->second.proto.get());
293 EXPECT_EQ("file5", pair_result->second.proto->base_name()); 293 EXPECT_EQ("file5", pair_result->second.proto->base_name());
294 294
295 // Confirm that the first non existent file is not found. 295 // Confirm that the first non existent file is not found.
296 pair_result.reset(); 296 pair_result.reset();
297 resource_metadata_.GetEntryInfoPairByPaths( 297 resource_metadata_.GetEntryInfoPairByPaths(
298 FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), 298 FilePath::FromUTF8Unsafe("drive/dir1/non_existent"),
299 FilePath::FromUTF8Unsafe("drive/dir1/file5"), 299 FilePath::FromUTF8Unsafe("drive/dir1/file5"),
300 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, 300 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback,
301 &pair_result)); 301 &pair_result));
302 test_util::RunBlockingPoolTask(); 302 gdata::test_util::RunBlockingPoolTask();
303 // The first entry should not be found. 303 // The first entry should not be found.
304 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error); 304 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error);
305 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), 305 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"),
306 pair_result->first.path); 306 pair_result->first.path);
307 ASSERT_FALSE(pair_result->first.proto.get()); 307 ASSERT_FALSE(pair_result->first.proto.get());
308 // The second entry should not be found, because the first one failed. 308 // The second entry should not be found, because the first one failed.
309 EXPECT_EQ(DRIVE_FILE_ERROR_FAILED, pair_result->second.error); 309 EXPECT_EQ(DRIVE_FILE_ERROR_FAILED, pair_result->second.error);
310 EXPECT_EQ(FilePath(), pair_result->second.path); 310 EXPECT_EQ(FilePath(), pair_result->second.path);
311 ASSERT_FALSE(pair_result->second.proto.get()); 311 ASSERT_FALSE(pair_result->second.proto.get());
312 312
313 // Confirm that the second non existent file is not found. 313 // Confirm that the second non existent file is not found.
314 pair_result.reset(); 314 pair_result.reset();
315 resource_metadata_.GetEntryInfoPairByPaths( 315 resource_metadata_.GetEntryInfoPairByPaths(
316 FilePath::FromUTF8Unsafe("drive/dir1/file4"), 316 FilePath::FromUTF8Unsafe("drive/dir1/file4"),
317 FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), 317 FilePath::FromUTF8Unsafe("drive/dir1/non_existent"),
318 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, 318 base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback,
319 &pair_result)); 319 &pair_result));
320 test_util::RunBlockingPoolTask(); 320 gdata::test_util::RunBlockingPoolTask();
321 // The first entry should be found. 321 // The first entry should be found.
322 EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); 322 EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error);
323 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), 323 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"),
324 pair_result->first.path); 324 pair_result->first.path);
325 ASSERT_TRUE(pair_result->first.proto.get()); 325 ASSERT_TRUE(pair_result->first.proto.get());
326 EXPECT_EQ("file4", pair_result->first.proto->base_name()); 326 EXPECT_EQ("file4", pair_result->first.proto->base_name());
327 // The second entry should not be found. 327 // The second entry should not be found.
328 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->second.error); 328 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->second.error);
329 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), 329 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"),
330 pair_result->second.path); 330 pair_result->second.path);
331 ASSERT_FALSE(pair_result->second.proto.get()); 331 ASSERT_FALSE(pair_result->second.proto.get());
332 } 332 }
333 333
334 TEST_F(DriveResourceMetadataTest, DBTest) { 334 TEST_F(DriveResourceMetadataTest, DBTest) {
335 TestingProfile profile; 335 TestingProfile profile;
336 scoped_refptr<base::SequencedWorkerPool> pool = 336 scoped_refptr<base::SequencedWorkerPool> pool =
337 content::BrowserThread::GetBlockingPool(); 337 content::BrowserThread::GetBlockingPool();
338 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner = 338 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
339 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 339 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
340 340
341 FilePath db_path(DriveCache::GetCacheRootPath(&profile). 341 FilePath db_path(DriveCache::GetCacheRootPath(&profile).
342 AppendASCII("meta").AppendASCII("resource_metadata.db")); 342 AppendASCII("meta").AppendASCII("resource_metadata.db"));
343 // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db 343 // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db
344 // doesn't exist. 344 // doesn't exist.
345 resource_metadata_.InitFromDB(db_path, blocking_task_runner, 345 resource_metadata_.InitFromDB(db_path, blocking_task_runner,
346 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_NOT_FOUND)); 346 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_NOT_FOUND));
347 test_util::RunBlockingPoolTask(); 347 gdata::test_util::RunBlockingPoolTask();
348 348
349 // Create a file system and write it to disk. 349 // Create a file system and write it to disk.
350 // We cannot call SaveToDB without first having called InitFromDB because 350 // We cannot call SaveToDB without first having called InitFromDB because
351 // InitFrom initializes the db_path and blocking_task_runner needed by 351 // InitFrom initializes the db_path and blocking_task_runner needed by
352 // SaveToDB. 352 // SaveToDB.
353 resource_metadata_.SaveToDB(); 353 resource_metadata_.SaveToDB();
354 test_util::RunBlockingPoolTask(); 354 gdata::test_util::RunBlockingPoolTask();
355 355
356 // InitFromDB should fail with DRIVE_FILE_ERROR_IN_USE. 356 // InitFromDB should fail with DRIVE_FILE_ERROR_IN_USE.
357 resource_metadata_.InitFromDB(db_path, blocking_task_runner, 357 resource_metadata_.InitFromDB(db_path, blocking_task_runner,
358 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_IN_USE)); 358 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_IN_USE));
359 test_util::RunBlockingPoolTask(); 359 gdata::test_util::RunBlockingPoolTask();
360 360
361 // InitFromDB should succeed. 361 // InitFromDB should succeed.
362 DriveResourceMetadata test_resource_metadata; 362 DriveResourceMetadata test_resource_metadata;
363 test_resource_metadata.InitFromDB(db_path, blocking_task_runner, 363 test_resource_metadata.InitFromDB(db_path, blocking_task_runner,
364 base::Bind(&InitFromDBCallback, DRIVE_FILE_OK)); 364 base::Bind(&InitFromDBCallback, DRIVE_FILE_OK));
365 test_util::RunBlockingPoolTask(); 365 gdata::test_util::RunBlockingPoolTask();
366 366
367 // Verify by checking for drive/dir2, which should have 3 children. 367 // Verify by checking for drive/dir2, which should have 3 children.
368 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 368 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
369 scoped_ptr<DriveEntryProtoVector> entries; 369 scoped_ptr<DriveEntryProtoVector> entries;
370 test_resource_metadata.ReadDirectoryByPath( 370 test_resource_metadata.ReadDirectoryByPath(
371 FilePath::FromUTF8Unsafe("drive/dir2"), 371 FilePath::FromUTF8Unsafe("drive/dir2"),
372 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 372 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
373 &error, &entries)); 373 &error, &entries));
374 test_util::RunBlockingPoolTask(); 374 gdata::test_util::RunBlockingPoolTask();
375 EXPECT_EQ(DRIVE_FILE_OK, error); 375 EXPECT_EQ(DRIVE_FILE_OK, error);
376 ASSERT_TRUE(entries.get()); 376 ASSERT_TRUE(entries.get());
377 ASSERT_EQ(3U, entries->size()); 377 ASSERT_EQ(3U, entries->size());
378 } 378 }
379 379
380 TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { 380 TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) {
381 // Make sure file9 is found. 381 // Make sure file9 is found.
382 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 382 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
383 FilePath drive_file_path; 383 FilePath drive_file_path;
384 const std::string file9_resource_id = "file_resource_id:file9"; 384 const std::string file9_resource_id = "file_resource_id:file9";
385 scoped_ptr<DriveEntryProto> entry_proto; 385 scoped_ptr<DriveEntryProto> entry_proto;
386 resource_metadata_.GetEntryInfoByResourceId( 386 resource_metadata_.GetEntryInfoByResourceId(
387 file9_resource_id, 387 file9_resource_id,
388 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 388 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
389 &error, &drive_file_path, &entry_proto)); 389 &error, &drive_file_path, &entry_proto));
390 test_util::RunBlockingPoolTask(); 390 gdata::test_util::RunBlockingPoolTask();
391 EXPECT_EQ(DRIVE_FILE_OK, error); 391 EXPECT_EQ(DRIVE_FILE_OK, error);
392 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path); 392 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path);
393 ASSERT_TRUE(entry_proto.get()); 393 ASSERT_TRUE(entry_proto.get());
394 EXPECT_EQ("file9", entry_proto->base_name()); 394 EXPECT_EQ("file9", entry_proto->base_name());
395 395
396 // Remove file9 using RemoveEntryFromParent. 396 // Remove file9 using RemoveEntryFromParent.
397 resource_metadata_.RemoveEntryFromParent( 397 resource_metadata_.RemoveEntryFromParent(
398 file9_resource_id, 398 file9_resource_id,
399 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 399 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
400 &error, &drive_file_path)); 400 &error, &drive_file_path));
401 test_util::RunBlockingPoolTask(); 401 gdata::test_util::RunBlockingPoolTask();
402 EXPECT_EQ(DRIVE_FILE_OK, error); 402 EXPECT_EQ(DRIVE_FILE_OK, error);
403 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); 403 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path);
404 404
405 // file9 should no longer exist. 405 // file9 should no longer exist.
406 resource_metadata_.GetEntryInfoByResourceId( 406 resource_metadata_.GetEntryInfoByResourceId(
407 file9_resource_id, 407 file9_resource_id,
408 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 408 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
409 &error, &drive_file_path, &entry_proto)); 409 &error, &drive_file_path, &entry_proto));
410 test_util::RunBlockingPoolTask(); 410 gdata::test_util::RunBlockingPoolTask();
411 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 411 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
412 EXPECT_FALSE(entry_proto.get()); 412 EXPECT_FALSE(entry_proto.get());
413 413
414 // Look for dir3. 414 // Look for dir3.
415 const std::string dir3_resource_id = "dir_resource_id:dir3"; 415 const std::string dir3_resource_id = "dir_resource_id:dir3";
416 resource_metadata_.GetEntryInfoByResourceId( 416 resource_metadata_.GetEntryInfoByResourceId(
417 dir3_resource_id, 417 dir3_resource_id,
418 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 418 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
419 &error, &drive_file_path, &entry_proto)); 419 &error, &drive_file_path, &entry_proto));
420 test_util::RunBlockingPoolTask(); 420 gdata::test_util::RunBlockingPoolTask();
421 EXPECT_EQ(DRIVE_FILE_OK, error); 421 EXPECT_EQ(DRIVE_FILE_OK, error);
422 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); 422 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path);
423 ASSERT_TRUE(entry_proto.get()); 423 ASSERT_TRUE(entry_proto.get());
424 EXPECT_EQ("dir3", entry_proto->base_name()); 424 EXPECT_EQ("dir3", entry_proto->base_name());
425 425
426 // Remove dir3 using RemoveEntryFromParent. 426 // Remove dir3 using RemoveEntryFromParent.
427 resource_metadata_.RemoveEntryFromParent( 427 resource_metadata_.RemoveEntryFromParent(
428 dir3_resource_id, 428 dir3_resource_id,
429 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 429 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
430 &error, &drive_file_path)); 430 &error, &drive_file_path));
431 test_util::RunBlockingPoolTask(); 431 gdata::test_util::RunBlockingPoolTask();
432 EXPECT_EQ(DRIVE_FILE_OK, error); 432 EXPECT_EQ(DRIVE_FILE_OK, error);
433 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); 433 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path);
434 434
435 // dir3 should no longer exist. 435 // dir3 should no longer exist.
436 resource_metadata_.GetEntryInfoByResourceId( 436 resource_metadata_.GetEntryInfoByResourceId(
437 dir3_resource_id, 437 dir3_resource_id,
438 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 438 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
439 &error, &drive_file_path, &entry_proto)); 439 &error, &drive_file_path, &entry_proto));
440 test_util::RunBlockingPoolTask(); 440 gdata::test_util::RunBlockingPoolTask();
441 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 441 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
442 EXPECT_FALSE(entry_proto.get()); 442 EXPECT_FALSE(entry_proto.get());
443 443
444 // Remove unknown resource_id using RemoveEntryFromParent. 444 // Remove unknown resource_id using RemoveEntryFromParent.
445 resource_metadata_.RemoveEntryFromParent( 445 resource_metadata_.RemoveEntryFromParent(
446 "foo", 446 "foo",
447 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 447 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
448 &error, &drive_file_path)); 448 &error, &drive_file_path));
449 test_util::RunBlockingPoolTask(); 449 gdata::test_util::RunBlockingPoolTask();
450 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 450 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
451 451
452 // Try removing root. This should fail. 452 // Try removing root. This should fail.
453 resource_metadata_.RemoveEntryFromParent( 453 resource_metadata_.RemoveEntryFromParent(
454 kDriveRootDirectoryResourceId, 454 kDriveRootDirectoryResourceId,
455 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 455 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
456 &error, &drive_file_path)); 456 &error, &drive_file_path));
457 test_util::RunBlockingPoolTask(); 457 gdata::test_util::RunBlockingPoolTask();
458 EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); 458 EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error);
459 } 459 }
460 460
461 TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { 461 TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) {
462 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 462 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
463 FilePath drive_file_path; 463 FilePath drive_file_path;
464 scoped_ptr<DriveEntryProto> entry_proto; 464 scoped_ptr<DriveEntryProto> entry_proto;
465 465
466 // Move file8 to drive/dir1. 466 // Move file8 to drive/dir1.
467 resource_metadata_.MoveEntryToDirectory( 467 resource_metadata_.MoveEntryToDirectory(
468 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 468 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
469 FilePath::FromUTF8Unsafe("drive/dir1"), 469 FilePath::FromUTF8Unsafe("drive/dir1"),
470 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 470 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
471 &error, &drive_file_path)); 471 &error, &drive_file_path));
472 test_util::RunBlockingPoolTask(); 472 gdata::test_util::RunBlockingPoolTask();
473 EXPECT_EQ(DRIVE_FILE_OK, error); 473 EXPECT_EQ(DRIVE_FILE_OK, error);
474 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); 474 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path);
475 475
476 // Look up the entry by its resource id and make sure it really moved. 476 // Look up the entry by its resource id and make sure it really moved.
477 resource_metadata_.GetEntryInfoByResourceId( 477 resource_metadata_.GetEntryInfoByResourceId(
478 "file_resource_id:file8", 478 "file_resource_id:file8",
479 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 479 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
480 &error, &drive_file_path, &entry_proto)); 480 &error, &drive_file_path, &entry_proto));
481 test_util::RunBlockingPoolTask(); 481 gdata::test_util::RunBlockingPoolTask();
482 EXPECT_EQ(DRIVE_FILE_OK, error); 482 EXPECT_EQ(DRIVE_FILE_OK, error);
483 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); 483 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path);
484 484
485 // Move non-existent file to drive/dir1. This should fail. 485 // Move non-existent file to drive/dir1. This should fail.
486 resource_metadata_.MoveEntryToDirectory( 486 resource_metadata_.MoveEntryToDirectory(
487 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 487 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
488 FilePath::FromUTF8Unsafe("drive/dir1"), 488 FilePath::FromUTF8Unsafe("drive/dir1"),
489 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 489 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
490 &error, &drive_file_path)); 490 &error, &drive_file_path));
491 test_util::RunBlockingPoolTask(); 491 gdata::test_util::RunBlockingPoolTask();
492 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 492 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
493 EXPECT_EQ(FilePath(), drive_file_path); 493 EXPECT_EQ(FilePath(), drive_file_path);
494 494
495 // Move existing file to non-existent directory. This should fail. 495 // Move existing file to non-existent directory. This should fail.
496 resource_metadata_.MoveEntryToDirectory( 496 resource_metadata_.MoveEntryToDirectory(
497 FilePath::FromUTF8Unsafe("drive/dir1/file8"), 497 FilePath::FromUTF8Unsafe("drive/dir1/file8"),
498 FilePath::FromUTF8Unsafe("drive/dir4"), 498 FilePath::FromUTF8Unsafe("drive/dir4"),
499 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 499 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
500 &error, &drive_file_path)); 500 &error, &drive_file_path));
501 test_util::RunBlockingPoolTask(); 501 gdata::test_util::RunBlockingPoolTask();
502 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 502 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
503 EXPECT_EQ(FilePath(), drive_file_path); 503 EXPECT_EQ(FilePath(), drive_file_path);
504 504
505 // Move existing file to existing file (non-directory). This should fail. 505 // Move existing file to existing file (non-directory). This should fail.
506 resource_metadata_.MoveEntryToDirectory( 506 resource_metadata_.MoveEntryToDirectory(
507 FilePath::FromUTF8Unsafe("drive/dir1/file8"), 507 FilePath::FromUTF8Unsafe("drive/dir1/file8"),
508 FilePath::FromUTF8Unsafe("drive/dir1/file4"), 508 FilePath::FromUTF8Unsafe("drive/dir1/file4"),
509 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 509 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
510 &error, &drive_file_path)); 510 &error, &drive_file_path));
511 test_util::RunBlockingPoolTask(); 511 gdata::test_util::RunBlockingPoolTask();
512 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); 512 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error);
513 EXPECT_EQ(FilePath(), drive_file_path); 513 EXPECT_EQ(FilePath(), drive_file_path);
514 514
515 // Move the file to root. 515 // Move the file to root.
516 resource_metadata_.MoveEntryToDirectory( 516 resource_metadata_.MoveEntryToDirectory(
517 FilePath::FromUTF8Unsafe("drive/dir1/file8"), 517 FilePath::FromUTF8Unsafe("drive/dir1/file8"),
518 FilePath::FromUTF8Unsafe("drive"), 518 FilePath::FromUTF8Unsafe("drive"),
519 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 519 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
520 &error, &drive_file_path)); 520 &error, &drive_file_path));
521 test_util::RunBlockingPoolTask(); 521 gdata::test_util::RunBlockingPoolTask();
522 EXPECT_EQ(DRIVE_FILE_OK, error); 522 EXPECT_EQ(DRIVE_FILE_OK, error);
523 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); 523 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path);
524 524
525 // Move the file from root. 525 // Move the file from root.
526 resource_metadata_.MoveEntryToDirectory( 526 resource_metadata_.MoveEntryToDirectory(
527 FilePath::FromUTF8Unsafe("drive/file8"), 527 FilePath::FromUTF8Unsafe("drive/file8"),
528 FilePath::FromUTF8Unsafe("drive/dir2"), 528 FilePath::FromUTF8Unsafe("drive/dir2"),
529 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 529 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
530 &error, &drive_file_path)); 530 &error, &drive_file_path));
531 test_util::RunBlockingPoolTask(); 531 gdata::test_util::RunBlockingPoolTask();
532 EXPECT_EQ(DRIVE_FILE_OK, error); 532 EXPECT_EQ(DRIVE_FILE_OK, error);
533 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); 533 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path);
534 534
535 // Make sure file is still ok. 535 // Make sure file is still ok.
536 resource_metadata_.GetEntryInfoByResourceId( 536 resource_metadata_.GetEntryInfoByResourceId(
537 "file_resource_id:file8", 537 "file_resource_id:file8",
538 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 538 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
539 &error, &drive_file_path, &entry_proto)); 539 &error, &drive_file_path, &entry_proto));
540 test_util::RunBlockingPoolTask(); 540 gdata::test_util::RunBlockingPoolTask();
541 EXPECT_EQ(DRIVE_FILE_OK, error); 541 EXPECT_EQ(DRIVE_FILE_OK, error);
542 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); 542 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path);
543 } 543 }
544 544
545 TEST_F(DriveResourceMetadataTest, RenameEntry) { 545 TEST_F(DriveResourceMetadataTest, RenameEntry) {
546 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 546 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
547 FilePath drive_file_path; 547 FilePath drive_file_path;
548 scoped_ptr<DriveEntryProto> entry_proto; 548 scoped_ptr<DriveEntryProto> entry_proto;
549 549
550 // Rename file8 to file11. 550 // Rename file8 to file11.
551 resource_metadata_.RenameEntry( 551 resource_metadata_.RenameEntry(
552 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 552 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
553 "file11", 553 "file11",
554 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 554 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
555 &error, &drive_file_path)); 555 &error, &drive_file_path));
556 test_util::RunBlockingPoolTask(); 556 gdata::test_util::RunBlockingPoolTask();
557 EXPECT_EQ(DRIVE_FILE_OK, error); 557 EXPECT_EQ(DRIVE_FILE_OK, error);
558 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); 558 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path);
559 559
560 // Lookup the file by resource id to make sure the file actually got renamed. 560 // Lookup the file by resource id to make sure the file actually got renamed.
561 resource_metadata_.GetEntryInfoByResourceId( 561 resource_metadata_.GetEntryInfoByResourceId(
562 "file_resource_id:file8", 562 "file_resource_id:file8",
563 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 563 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
564 &error, &drive_file_path, &entry_proto)); 564 &error, &drive_file_path, &entry_proto));
565 test_util::RunBlockingPoolTask(); 565 gdata::test_util::RunBlockingPoolTask();
566 EXPECT_EQ(DRIVE_FILE_OK, error); 566 EXPECT_EQ(DRIVE_FILE_OK, error);
567 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); 567 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path);
568 568
569 // Rename to file7 to force a duplicate name. 569 // Rename to file7 to force a duplicate name.
570 resource_metadata_.RenameEntry( 570 resource_metadata_.RenameEntry(
571 FilePath::FromUTF8Unsafe("drive/dir2/file11"), 571 FilePath::FromUTF8Unsafe("drive/dir2/file11"),
572 "file7", 572 "file7",
573 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 573 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
574 &error, &drive_file_path)); 574 &error, &drive_file_path));
575 test_util::RunBlockingPoolTask(); 575 gdata::test_util::RunBlockingPoolTask();
576 EXPECT_EQ(DRIVE_FILE_OK, error); 576 EXPECT_EQ(DRIVE_FILE_OK, error);
577 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), drive_file_path); 577 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), drive_file_path);
578 578
579 // Rename to same name. This should fail. 579 // Rename to same name. This should fail.
580 resource_metadata_.RenameEntry( 580 resource_metadata_.RenameEntry(
581 FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), 581 FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"),
582 "file7 (2)", 582 "file7 (2)",
583 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 583 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
584 &error, &drive_file_path)); 584 &error, &drive_file_path));
585 test_util::RunBlockingPoolTask(); 585 gdata::test_util::RunBlockingPoolTask();
586 EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error); 586 EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error);
587 EXPECT_EQ(FilePath(), drive_file_path); 587 EXPECT_EQ(FilePath(), drive_file_path);
588 588
589 // Rename non-existent. 589 // Rename non-existent.
590 resource_metadata_.RenameEntry( 590 resource_metadata_.RenameEntry(
591 FilePath::FromUTF8Unsafe("drive/dir2/file11"), 591 FilePath::FromUTF8Unsafe("drive/dir2/file11"),
592 "file11", 592 "file11",
593 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 593 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
594 &error, &drive_file_path)); 594 &error, &drive_file_path));
595 test_util::RunBlockingPoolTask(); 595 gdata::test_util::RunBlockingPoolTask();
596 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 596 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
597 EXPECT_EQ(FilePath(), drive_file_path); 597 EXPECT_EQ(FilePath(), drive_file_path);
598 } 598 }
599 599
600 } // namespace gdata 600 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_resource_metadata.cc ('k') | chrome/browser/chromeos/drive/drive_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698