| 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/resource_metadata.h" | 5 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 entry.Clear(); | 952 entry.Clear(); |
| 953 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->GetResourceEntryByPath( | 953 EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->GetResourceEntryByPath( |
| 954 base::FilePath::FromUTF8Unsafe("drive/root/dir1/dir3/dir100/file6"), | 954 base::FilePath::FromUTF8Unsafe("drive/root/dir1/dir3/dir100/file6"), |
| 955 &entry)); | 955 &entry)); |
| 956 EXPECT_EQ("file6", entry.base_name()); | 956 EXPECT_EQ("file6", entry.base_name()); |
| 957 | 957 |
| 958 // Make sure dir2 no longer exists. | 958 // Make sure dir2 no longer exists. |
| 959 EXPECT_EQ(FILE_ERROR_NOT_FOUND, resource_metadata_->GetResourceEntryByPath( | 959 EXPECT_EQ(FILE_ERROR_NOT_FOUND, resource_metadata_->GetResourceEntryByPath( |
| 960 base::FilePath::FromUTF8Unsafe("drive/root/dir2"), &entry)); | 960 base::FilePath::FromUTF8Unsafe("drive/root/dir2"), &entry)); |
| 961 | 961 |
| 962 // Make sure that directory cannot move under a file. |
| 963 dir_entry.set_parent_local_id(file_entry.resource_id()); |
| 964 EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, |
| 965 resource_metadata_->RefreshEntry(dir_entry)); |
| 966 |
| 962 // Cannot refresh root. | 967 // Cannot refresh root. |
| 963 dir_entry.Clear(); | 968 dir_entry.Clear(); |
| 964 dir_entry.set_resource_id(util::kDriveGrandRootSpecialResourceId); | 969 dir_entry.set_resource_id(util::kDriveGrandRootSpecialResourceId); |
| 965 dir_entry.set_title("new-root-name"); | 970 dir_entry.set_title("new-root-name"); |
| 966 dir_entry.set_parent_local_id("resource_id:dir1"); | 971 dir_entry.set_parent_local_id("resource_id:dir1"); |
| 967 EXPECT_EQ(FILE_ERROR_INVALID_OPERATION, | 972 EXPECT_EQ(FILE_ERROR_INVALID_OPERATION, |
| 968 resource_metadata_->RefreshEntry(dir_entry)); | 973 resource_metadata_->RefreshEntry(dir_entry)); |
| 969 } | 974 } |
| 970 | 975 |
| 971 TEST_F(ResourceMetadataTest, GetChildDirectories) { | 976 TEST_F(ResourceMetadataTest, GetChildDirectories) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 else | 1078 else |
| 1074 ++directory_count; | 1079 ++directory_count; |
| 1075 } | 1080 } |
| 1076 | 1081 |
| 1077 EXPECT_EQ(7, file_count); | 1082 EXPECT_EQ(7, file_count); |
| 1078 EXPECT_EQ(6, directory_count); | 1083 EXPECT_EQ(6, directory_count); |
| 1079 } | 1084 } |
| 1080 | 1085 |
| 1081 } // namespace internal | 1086 } // namespace internal |
| 1082 } // namespace drive | 1087 } // namespace drive |
| OLD | NEW |