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