OLD | NEW |
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_file_system.h" | 5 #include "chrome/browser/chromeos/drive/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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 ASSERT_TRUE(LoadRootFeedDocument()); | 702 ASSERT_TRUE(LoadRootFeedDocument()); |
703 | 703 |
704 const base::FilePath kFilePath = base::FilePath( | 704 const base::FilePath kFilePath = base::FilePath( |
705 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/" | 705 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/" |
706 "Sub Sub Directory Folder")); | 706 "Sub Sub Directory Folder")); |
707 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); | 707 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); |
708 ASSERT_TRUE(entry.get()); | 708 ASSERT_TRUE(entry.get()); |
709 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); | 709 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); |
710 } | 710 } |
711 | 711 |
| 712 TEST_F(DriveFileSystemTest, SearchOrphanFile) { |
| 713 ASSERT_TRUE(LoadRootFeedDocument()); |
| 714 |
| 715 const base::FilePath kFilePath = base::FilePath( |
| 716 FILE_PATH_LITERAL("drive/other/Orphan File 1.txt")); |
| 717 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); |
| 718 ASSERT_TRUE(entry.get()); |
| 719 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id()); |
| 720 } |
| 721 |
712 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) { | 722 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) { |
713 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 723 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
714 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); | 724 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); |
715 | 725 |
716 // ReadDirectoryByPath() should kick off the resource list loading. | 726 // ReadDirectoryByPath() should kick off the resource list loading. |
717 scoped_ptr<DriveEntryProtoVector> entries( | 727 scoped_ptr<DriveEntryProtoVector> entries( |
718 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive/root"))); | 728 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive/root"))); |
719 // The root directory should be read correctly. | 729 // The root directory should be read correctly. |
720 ASSERT_TRUE(entries.get()); | 730 ASSERT_TRUE(entries.get()); |
721 EXPECT_EQ(8U, entries->size()); | 731 EXPECT_EQ(8U, entries->size()); |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 | 2178 |
2169 // An app for foo.exe should now be found, as the registry was loaded. | 2179 // An app for foo.exe should now be found, as the registry was loaded. |
2170 drive_webapps_registry_->GetWebAppsForFile( | 2180 drive_webapps_registry_->GetWebAppsForFile( |
2171 base::FilePath(FILE_PATH_LITERAL("foo.exe")), | 2181 base::FilePath(FILE_PATH_LITERAL("foo.exe")), |
2172 "" /* mime_type */, | 2182 "" /* mime_type */, |
2173 &apps); | 2183 &apps); |
2174 EXPECT_EQ(1U, apps.size()); | 2184 EXPECT_EQ(1U, apps.size()); |
2175 } | 2185 } |
2176 | 2186 |
2177 } // namespace drive | 2187 } // namespace drive |
OLD | NEW |