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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 ASSERT_TRUE(LoadRootFeedDocument()); | 791 ASSERT_TRUE(LoadRootFeedDocument()); |
792 | 792 |
793 const base::FilePath kFilePath = base::FilePath( | 793 const base::FilePath kFilePath = base::FilePath( |
794 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/" | 794 FILE_PATH_LITERAL("drive/root/Directory 1/Sub Directory Folder/" |
795 "Sub Sub Directory Folder")); | 795 "Sub Sub Directory Folder")); |
796 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); | 796 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); |
797 ASSERT_TRUE(entry.get()); | 797 ASSERT_TRUE(entry.get()); |
798 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); | 798 ASSERT_EQ("folder:sub_sub_directory_folder_id", entry->resource_id()); |
799 } | 799 } |
800 | 800 |
| 801 TEST_F(DriveFileSystemTest, SearchOrphanFile) { |
| 802 ASSERT_TRUE(LoadRootFeedDocument()); |
| 803 |
| 804 const base::FilePath kFilePath = base::FilePath( |
| 805 FILE_PATH_LITERAL("drive/other/Orphan File 1.txt")); |
| 806 scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); |
| 807 ASSERT_TRUE(entry.get()); |
| 808 EXPECT_EQ("file:1_orphanfile_resource_id", entry->resource_id()); |
| 809 } |
| 810 |
801 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) { | 811 TEST_F(DriveFileSystemTest, ReadDirectoryByPath_Root) { |
802 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( | 812 EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( |
803 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); | 813 Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1); |
804 | 814 |
805 // ReadDirectoryByPath() should kick off the resource list loading. | 815 // ReadDirectoryByPath() should kick off the resource list loading. |
806 scoped_ptr<DriveEntryProtoVector> entries( | 816 scoped_ptr<DriveEntryProtoVector> entries( |
807 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive/root"))); | 817 ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive/root"))); |
808 // The root directory should be read correctly. | 818 // The root directory should be read correctly. |
809 ASSERT_TRUE(entries.get()); | 819 ASSERT_TRUE(entries.get()); |
810 EXPECT_EQ(8U, entries->size()); | 820 EXPECT_EQ(8U, entries->size()); |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 | 2267 |
2258 // An app for foo.exe should now be found, as the registry was loaded. | 2268 // An app for foo.exe should now be found, as the registry was loaded. |
2259 drive_webapps_registry_->GetWebAppsForFile( | 2269 drive_webapps_registry_->GetWebAppsForFile( |
2260 base::FilePath(FILE_PATH_LITERAL("foo.exe")), | 2270 base::FilePath(FILE_PATH_LITERAL("foo.exe")), |
2261 "" /* mime_type */, | 2271 "" /* mime_type */, |
2262 &apps); | 2272 &apps); |
2263 EXPECT_EQ(1U, apps.size()); | 2273 EXPECT_EQ(1U, apps.size()); |
2264 } | 2274 } |
2265 | 2275 |
2266 } // namespace drive | 2276 } // namespace drive |
OLD | NEW |