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

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

Issue 66293005: drive: Add drive/trash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix RemoveEntry Created 7 years, 1 month 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 | « no previous file | chrome/browser/chromeos/drive/file_system_util.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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 ASSERT_TRUE(entry); 427 ASSERT_TRUE(entry);
428 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id()); 428 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id());
429 } 429 }
430 430
431 TEST_F(FileSystemTest, ReadDirectory_Root) { 431 TEST_F(FileSystemTest, ReadDirectory_Root) {
432 // ReadDirectory() should kick off the resource list loading. 432 // ReadDirectory() should kick off the resource list loading.
433 scoped_ptr<ResourceEntryVector> entries( 433 scoped_ptr<ResourceEntryVector> entries(
434 ReadDirectorySync(base::FilePath::FromUTF8Unsafe("drive"))); 434 ReadDirectorySync(base::FilePath::FromUTF8Unsafe("drive")));
435 // The root directory should be read correctly. 435 // The root directory should be read correctly.
436 ASSERT_TRUE(entries); 436 ASSERT_TRUE(entries);
437 ASSERT_EQ(2U, entries->size()); 437 ASSERT_EQ(3U, entries->size());
438 438
439 // The found two directories should be /drive/root and /drive/other. 439 // The found three directories should be /drive/root, /drive/other and
440 bool found_other = false; 440 // /drive/trash.
441 bool found_my_drive = false; 441 std::set<base::FilePath> found;
442 for (size_t i = 0; i < entries->size(); ++i) { 442 for (size_t i = 0; i < entries->size(); ++i)
443 const base::FilePath title = 443 found.insert(base::FilePath::FromUTF8Unsafe((*entries)[i].title()));
444 base::FilePath::FromUTF8Unsafe((*entries)[i].title()); 444 EXPECT_EQ(3U, found.size());
445 if (title == base::FilePath(util::kDriveOtherDirName)) { 445 EXPECT_EQ(1U, found.count(base::FilePath(util::kDriveMyDriveRootDirName)));
446 found_other = true; 446 EXPECT_EQ(1U, found.count(base::FilePath(util::kDriveOtherDirName)));
447 } else if (title == base::FilePath(util::kDriveMyDriveRootDirName)) { 447 EXPECT_EQ(1U, found.count(base::FilePath(util::kDriveTrashDirName)));
448 found_my_drive = true;
449 }
450 }
451
452 EXPECT_TRUE(found_other);
453 EXPECT_TRUE(found_my_drive);
454 448
455 ASSERT_EQ(1u, mock_directory_observer_->changed_directories().size()); 449 ASSERT_EQ(1u, mock_directory_observer_->changed_directories().size());
456 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive")), 450 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("drive")),
457 mock_directory_observer_->changed_directories()[0]); 451 mock_directory_observer_->changed_directories()[0]);
458 } 452 }
459 453
460 TEST_F(FileSystemTest, ReadDirectory_NonRootDirectory) { 454 TEST_F(FileSystemTest, ReadDirectory_NonRootDirectory) {
461 // ReadDirectory() should kick off the resource list loading. 455 // ReadDirectory() should kick off the resource list loading.
462 scoped_ptr<ResourceEntryVector> entries( 456 scoped_ptr<ResourceEntryVector> entries(
463 ReadDirectorySync( 457 ReadDirectorySync(
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 kEmbedOrigin, 734 kEmbedOrigin,
741 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); 735 google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
742 test_util::RunBlockingPoolTask(); 736 test_util::RunBlockingPoolTask();
743 737
744 // Verify the error and the share url, which should be empty. 738 // Verify the error and the share url, which should be empty.
745 EXPECT_EQ(FILE_ERROR_FAILED, error); 739 EXPECT_EQ(FILE_ERROR_FAILED, error);
746 EXPECT_TRUE(share_url.is_empty()); 740 EXPECT_TRUE(share_url.is_empty());
747 } 741 }
748 742
749 } // namespace drive 743 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_system_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698