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

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

Issue 23441049: drive: Enable recursive fast-fetch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made the test to surely use fast-fetch. 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.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/file_system.h" 5 #include "chrome/browser/chromeos/drive/file_system.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // After "fast fetch" is done, full resource list is fetched. 373 // After "fast fetch" is done, full resource list is fetched.
374 EXPECT_EQ(1, fake_drive_service_->resource_list_load_count()); 374 EXPECT_EQ(1, fake_drive_service_->resource_list_load_count());
375 375
376 // "Fast fetch" will fire an OnirectoryChanged event. 376 // "Fast fetch" will fire an OnirectoryChanged event.
377 ASSERT_EQ(1u, mock_directory_observer_->changed_directories().size()); 377 ASSERT_EQ(1u, mock_directory_observer_->changed_directories().size());
378 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive")), 378 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive")),
379 mock_directory_observer_->changed_directories()[0]); 379 mock_directory_observer_->changed_directories()[0]);
380 } 380 }
381 381
382 TEST_F(FileSystemTest, GetExistingFile) { 382 TEST_F(FileSystemTest, GetExistingFile) {
383 // Simulate the situation that full feed fetching takes very long time,
384 // to test the "fast fetch" feature is properly working.
satorux1 2013/09/06 08:32:25 "fast fetch" -> recursive "fast fetch"
kinaba 2013/09/06 10:12:14 Done.
385 fake_drive_service_->set_never_return_all_resource_list(true);
386
383 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 387 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
satorux1 2013/09/06 08:32:25 could you make this one level deeper, to make it m
kinaba 2013/09/06 10:12:14 Done.
384 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath); 388 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath);
385 ASSERT_TRUE(entry); 389 ASSERT_TRUE(entry);
386 EXPECT_EQ("file:2_file_resource_id", entry->resource_id()); 390 EXPECT_EQ("file:2_file_resource_id", entry->resource_id());
387 391
388 EXPECT_EQ(1, fake_drive_service_->about_resource_load_count()); 392 // Directory load for "drive" and "drive/root" that loads about_resource,
389 EXPECT_EQ(1, fake_drive_service_->resource_list_load_count()); 393 // and one background full resource list loading.
394 EXPECT_EQ(2, fake_drive_service_->about_resource_load_count());
395 EXPECT_EQ(1, fake_drive_service_->blocked_resource_list_load_count());
390 } 396 }
391 397
392 TEST_F(FileSystemTest, GetExistingDocument) { 398 TEST_F(FileSystemTest, GetExistingDocument) {
393 const base::FilePath kFilePath( 399 const base::FilePath kFilePath(
394 FILE_PATH_LITERAL("drive/root/Document 1 excludeDir-test.gdoc")); 400 FILE_PATH_LITERAL("drive/root/Document 1 excludeDir-test.gdoc"));
395 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath); 401 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath);
396 ASSERT_TRUE(entry); 402 ASSERT_TRUE(entry);
397 EXPECT_EQ("document:5_document_resource_id", entry->resource_id()); 403 EXPECT_EQ("document:5_document_resource_id", entry->resource_id());
398 } 404 }
399 405
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 TEST_F(FileSystemTest, GetInSubSubdir) { 466 TEST_F(FileSystemTest, GetInSubSubdir) {
461 const base::FilePath kFilePath( 467 const base::FilePath kFilePath(
462 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/" 468 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/"
463 "Sub Sub Directory Folder")); 469 "Sub Sub Directory Folder"));
464 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath); 470 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath);
465 ASSERT_TRUE(entry); 471 ASSERT_TRUE(entry);
466 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); 472 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id());
467 } 473 }
468 474
469 TEST_F(FileSystemTest, GetOrphanFile) { 475 TEST_F(FileSystemTest, GetOrphanFile) {
476 ASSERT_TRUE(LoadFullResourceList());
477
478 // Entry without parents are placed under "drive/other".
470 const base::FilePath kFilePath( 479 const base::FilePath kFilePath(
471 FILE_PATH_LITERAL("drive/other/Orphan File 1.txt")); 480 FILE_PATH_LITERAL("drive/other/Orphan File 1.txt"));
472 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath); 481 scoped_ptr<ResourceEntry> entry = GetResourceEntryByPathSync(kFilePath);
473 ASSERT_TRUE(entry); 482 ASSERT_TRUE(entry);
474 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id()); 483 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id());
475 } 484 }
476 485
477 TEST_F(FileSystemTest, ReadDirectoryByPath_Root) { 486 TEST_F(FileSystemTest, ReadDirectoryByPath_Root) {
478 // ReadDirectoryByPath() should kick off the resource list loading. 487 // ReadDirectoryByPath() should kick off the resource list loading.
479 scoped_ptr<ResourceEntryVector> entries( 488 scoped_ptr<ResourceEntryVector> entries(
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 kEmbedOrigin, 876 kEmbedOrigin,
868 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); 877 google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
869 test_util::RunBlockingPoolTask(); 878 test_util::RunBlockingPoolTask();
870 879
871 // Verify the error and the share url, which should be empty. 880 // Verify the error and the share url, which should be empty.
872 EXPECT_EQ(FILE_ERROR_FAILED, error); 881 EXPECT_EQ(FILE_ERROR_FAILED, error);
873 EXPECT_TRUE(share_url.is_empty()); 882 EXPECT_TRUE(share_url.is_empty());
874 } 883 }
875 884
876 } // namespace drive 885 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.cc ('k') | chrome/browser/drive/fake_drive_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698