| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 EXPECT_EQ(entry->GetFilePath(), file_path); | 268 EXPECT_EQ(entry->GetFilePath(), file_path); |
| 269 } | 269 } |
| 270 | 270 |
| 271 GDataEntry* FindEntryByResourceId(const std::string& resource_id) { | 271 GDataEntry* FindEntryByResourceId(const std::string& resource_id) { |
| 272 ReadOnlyFindEntryDelegate search_delegate; | 272 ReadOnlyFindEntryDelegate search_delegate; |
| 273 file_system_->FindEntryByResourceIdSync(resource_id, | 273 file_system_->FindEntryByResourceIdSync(resource_id, |
| 274 &search_delegate); | 274 &search_delegate); |
| 275 return search_delegate.entry(); | 275 return search_delegate.entry(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Gets the entry info for |file_path| and compares the contents against |
| 279 // |entry|. Returns true if the entry info matches |entry|. |
| 280 bool GetEntryInfoAndCompare(const FilePath& file_path, |
| 281 GDataEntry* entry) { |
| 282 file_system_->GetEntryInfoByPathAsync( |
| 283 file_path, |
| 284 base::Bind(&CallbackHelper::GetEntryInfoCallback, |
| 285 callback_helper_.get())); |
| 286 message_loop_.RunAllPending(); |
| 287 |
| 288 if (entry == NULL) { |
| 289 // Entry info is expected not to be found. |
| 290 return (callback_helper_->last_error_ == |
| 291 base::PLATFORM_FILE_ERROR_NOT_FOUND && |
| 292 callback_helper_->entry_proto_ == NULL); |
| 293 } |
| 294 |
| 295 if (callback_helper_->last_error_ != base::PLATFORM_FILE_OK) |
| 296 return false; |
| 297 |
| 298 scoped_ptr<GDataEntryProto> entry_proto = |
| 299 callback_helper_->entry_proto_.Pass(); |
| 300 return (entry->resource_id() == entry_proto->resource_id()); |
| 301 } |
| 302 |
| 278 // Gets the file info for |file_path| and compares the contents against | 303 // Gets the file info for |file_path| and compares the contents against |
| 279 // |file|. Returns true if the file info matches |file|. | 304 // |file|. Returns true if the file info matches |file|. |
| 280 bool GetFileInfoAndCompare(const FilePath& file_path, | 305 bool GetFileInfoAndCompare(const FilePath& file_path, |
| 281 GDataFile* file) { | 306 GDataFile* file) { |
| 282 file_system_->GetFileInfoByPathAsync( | 307 file_system_->GetFileInfoByPathAsync( |
| 283 file_path, | 308 file_path, |
| 284 base::Bind(&CallbackHelper::GetFileInfoCallback, | 309 base::Bind(&CallbackHelper::GetFileInfoCallback, |
| 285 callback_helper_.get())); | 310 callback_helper_.get())); |
| 286 message_loop_.RunAllPending(); | 311 message_loop_.RunAllPending(); |
| 287 | 312 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 } | 1047 } |
| 1023 | 1048 |
| 1024 virtual void GetAvailableSpaceCallback(base::PlatformFileError error, | 1049 virtual void GetAvailableSpaceCallback(base::PlatformFileError error, |
| 1025 int64 bytes_total, | 1050 int64 bytes_total, |
| 1026 int64 bytes_used) { | 1051 int64 bytes_used) { |
| 1027 last_error_ = error; | 1052 last_error_ = error; |
| 1028 quota_bytes_total_ = bytes_total; | 1053 quota_bytes_total_ = bytes_total; |
| 1029 quota_bytes_used_ = bytes_used; | 1054 quota_bytes_used_ = bytes_used; |
| 1030 } | 1055 } |
| 1031 | 1056 |
| 1057 virtual void GetEntryInfoCallback( |
| 1058 base::PlatformFileError error, |
| 1059 scoped_ptr<GDataEntryProto> entry_proto) { |
| 1060 last_error_ = error; |
| 1061 entry_proto_ = entry_proto.Pass(); |
| 1062 } |
| 1063 |
| 1032 virtual void GetFileInfoCallback( | 1064 virtual void GetFileInfoCallback( |
| 1033 base::PlatformFileError error, | 1065 base::PlatformFileError error, |
| 1034 scoped_ptr<GDataFileProto> file_proto) { | 1066 scoped_ptr<GDataFileProto> file_proto) { |
| 1035 last_error_ = error; | 1067 last_error_ = error; |
| 1036 file_proto_ = file_proto.Pass(); | 1068 file_proto_ = file_proto.Pass(); |
| 1037 } | 1069 } |
| 1038 | 1070 |
| 1039 virtual void ReadDirectoryCallback( | 1071 virtual void ReadDirectoryCallback( |
| 1040 base::PlatformFileError error, | 1072 base::PlatformFileError error, |
| 1041 scoped_ptr<GDataDirectoryProto> directory_proto) { | 1073 scoped_ptr<GDataDirectoryProto> directory_proto) { |
| 1042 last_error_ = error; | 1074 last_error_ = error; |
| 1043 directory_proto_ = directory_proto.Pass(); | 1075 directory_proto_ = directory_proto.Pass(); |
| 1044 } | 1076 } |
| 1045 | 1077 |
| 1046 base::PlatformFileError last_error_; | 1078 base::PlatformFileError last_error_; |
| 1047 FilePath download_path_; | 1079 FilePath download_path_; |
| 1048 std::string mime_type_; | 1080 std::string mime_type_; |
| 1049 GDataFileType file_type_; | 1081 GDataFileType file_type_; |
| 1050 int64 quota_bytes_total_; | 1082 int64 quota_bytes_total_; |
| 1051 int64 quota_bytes_used_; | 1083 int64 quota_bytes_used_; |
| 1084 scoped_ptr<GDataEntryProto> entry_proto_; |
| 1052 scoped_ptr<GDataFileProto> file_proto_; | 1085 scoped_ptr<GDataFileProto> file_proto_; |
| 1053 scoped_ptr<GDataDirectoryProto> directory_proto_; | 1086 scoped_ptr<GDataDirectoryProto> directory_proto_; |
| 1054 }; | 1087 }; |
| 1055 | 1088 |
| 1056 MessageLoopForUI message_loop_; | 1089 MessageLoopForUI message_loop_; |
| 1057 // The order of the test threads is important, do not change the order. | 1090 // The order of the test threads is important, do not change the order. |
| 1058 // See also content/browser/browser_thread_imple.cc. | 1091 // See also content/browser/browser_thread_imple.cc. |
| 1059 content::TestBrowserThread ui_thread_; | 1092 content::TestBrowserThread ui_thread_; |
| 1060 content::TestBrowserThread io_thread_; | 1093 content::TestBrowserThread io_thread_; |
| 1061 scoped_ptr<TestingProfile> profile_; | 1094 scoped_ptr<TestingProfile> profile_; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 EXPECT_EQ(2, counter); | 1145 EXPECT_EQ(2, counter); |
| 1113 } | 1146 } |
| 1114 | 1147 |
| 1115 TEST_F(GDataFileSystemTest, SearchRootDirectory) { | 1148 TEST_F(GDataFileSystemTest, SearchRootDirectory) { |
| 1116 LoadRootFeedDocument("root_feed.json"); | 1149 LoadRootFeedDocument("root_feed.json"); |
| 1117 | 1150 |
| 1118 const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("gdata")); | 1151 const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("gdata")); |
| 1119 GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath))); | 1152 GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath))); |
| 1120 ASSERT_TRUE(entry); | 1153 ASSERT_TRUE(entry); |
| 1121 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1154 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1155 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1122 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); | 1156 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); |
| 1123 } | 1157 } |
| 1124 | 1158 |
| 1125 TEST_F(GDataFileSystemTest, SearchExistingFile) { | 1159 TEST_F(GDataFileSystemTest, SearchExistingFile) { |
| 1126 LoadRootFeedDocument("root_feed.json"); | 1160 LoadRootFeedDocument("root_feed.json"); |
| 1127 | 1161 |
| 1128 const FilePath kFilePath = FilePath( | 1162 const FilePath kFilePath = FilePath( |
| 1129 FILE_PATH_LITERAL("gdata/File 1.txt")); | 1163 FILE_PATH_LITERAL("gdata/File 1.txt")); |
| 1130 GDataEntry* entry = FindEntry(kFilePath); | 1164 GDataEntry* entry = FindEntry(kFilePath); |
| 1131 ASSERT_TRUE(entry); | 1165 ASSERT_TRUE(entry); |
| 1132 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1166 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1167 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1133 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); | 1168 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); |
| 1134 } | 1169 } |
| 1135 | 1170 |
| 1136 TEST_F(GDataFileSystemTest, SearchExistingDocument) { | 1171 TEST_F(GDataFileSystemTest, SearchExistingDocument) { |
| 1137 LoadRootFeedDocument("root_feed.json"); | 1172 LoadRootFeedDocument("root_feed.json"); |
| 1138 | 1173 |
| 1139 const FilePath kFilePath = FilePath( | 1174 const FilePath kFilePath = FilePath( |
| 1140 FILE_PATH_LITERAL("gdata/Document 1.gdoc")); | 1175 FILE_PATH_LITERAL("gdata/Document 1.gdoc")); |
| 1141 GDataEntry* entry = FindEntry(kFilePath); | 1176 GDataEntry* entry = FindEntry(kFilePath); |
| 1142 ASSERT_TRUE(entry); | 1177 ASSERT_TRUE(entry); |
| 1143 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1178 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1179 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1144 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); | 1180 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); |
| 1145 } | 1181 } |
| 1146 | 1182 |
| 1147 TEST_F(GDataFileSystemTest, SearchNonExistingFile) { | 1183 TEST_F(GDataFileSystemTest, SearchNonExistingFile) { |
| 1148 LoadRootFeedDocument("root_feed.json"); | 1184 LoadRootFeedDocument("root_feed.json"); |
| 1149 | 1185 |
| 1150 const FilePath kFilePath = FilePath( | 1186 const FilePath kFilePath = FilePath( |
| 1151 FILE_PATH_LITERAL("gdata/nonexisting.file")); | 1187 FILE_PATH_LITERAL("gdata/nonexisting.file")); |
| 1152 GDataEntry* entry = FindEntry(kFilePath); | 1188 GDataEntry* entry = FindEntry(kFilePath); |
| 1153 ASSERT_FALSE(entry); | 1189 ASSERT_FALSE(entry); |
| 1190 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1154 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, NULL)); | 1191 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, NULL)); |
| 1155 } | 1192 } |
| 1156 | 1193 |
| 1157 TEST_F(GDataFileSystemTest, SearchEncodedFileNames) { | 1194 TEST_F(GDataFileSystemTest, SearchEncodedFileNames) { |
| 1158 LoadRootFeedDocument("root_feed.json"); | 1195 LoadRootFeedDocument("root_feed.json"); |
| 1159 | 1196 |
| 1160 const FilePath kFilePath1 = FilePath( | 1197 const FilePath kFilePath1 = FilePath( |
| 1161 FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); | 1198 FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); |
| 1162 GDataEntry* entry = FindEntry(kFilePath1); | 1199 GDataEntry* entry = FindEntry(kFilePath1); |
| 1163 ASSERT_FALSE(entry); | 1200 ASSERT_FALSE(entry); |
| 1201 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, NULL)); |
| 1202 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, NULL)); |
| 1164 | 1203 |
| 1165 const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( | 1204 const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( |
| 1166 "gdata/Slash \xE2\x88\x95 in file 1.txt"); | 1205 "gdata/Slash \xE2\x88\x95 in file 1.txt"); |
| 1167 entry = FindEntry(kFilePath2); | 1206 entry = FindEntry(kFilePath2); |
| 1168 ASSERT_TRUE(entry); | 1207 ASSERT_TRUE(entry); |
| 1169 EXPECT_EQ(kFilePath2, entry->GetFilePath()); | 1208 EXPECT_EQ(kFilePath2, entry->GetFilePath()); |
| 1209 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry)); |
| 1170 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); | 1210 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); |
| 1171 | 1211 |
| 1172 const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( | 1212 const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( |
| 1173 "gdata/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); | 1213 "gdata/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); |
| 1174 entry = FindEntry(kFilePath3); | 1214 entry = FindEntry(kFilePath3); |
| 1175 ASSERT_TRUE(entry); | 1215 ASSERT_TRUE(entry); |
| 1176 EXPECT_EQ(kFilePath3, entry->GetFilePath()); | 1216 EXPECT_EQ(kFilePath3, entry->GetFilePath()); |
| 1217 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath3, entry)); |
| 1177 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); | 1218 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); |
| 1178 } | 1219 } |
| 1179 | 1220 |
| 1180 TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) { | 1221 TEST_F(GDataFileSystemTest, SearchEncodedFileNamesLoadingRoot) { |
| 1181 LoadRootFeedDocument("root_feed.json"); | 1222 LoadRootFeedDocument("root_feed.json"); |
| 1182 | 1223 |
| 1183 const FilePath kFilePath1 = FilePath( | 1224 const FilePath kFilePath1 = FilePath( |
| 1184 FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); | 1225 FILE_PATH_LITERAL("gdata/Slash / in file 1.txt")); |
| 1185 GDataEntry* entry = FindEntry(kFilePath1); | 1226 GDataEntry* entry = FindEntry(kFilePath1); |
| 1186 ASSERT_FALSE(entry); | 1227 ASSERT_FALSE(entry); |
| 1228 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, NULL)); |
| 1229 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, NULL)); |
| 1187 | 1230 |
| 1188 const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( | 1231 const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( |
| 1189 "gdata/Slash \xE2\x88\x95 in file 1.txt"); | 1232 "gdata/Slash \xE2\x88\x95 in file 1.txt"); |
| 1190 entry = FindEntry(kFilePath2); | 1233 entry = FindEntry(kFilePath2); |
| 1191 ASSERT_TRUE(entry); | 1234 ASSERT_TRUE(entry); |
| 1192 EXPECT_EQ(kFilePath2, entry->GetFilePath()); | 1235 EXPECT_EQ(kFilePath2, entry->GetFilePath()); |
| 1236 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry)); |
| 1193 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); | 1237 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); |
| 1194 | 1238 |
| 1195 const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( | 1239 const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( |
| 1196 "gdata/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); | 1240 "gdata/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); |
| 1197 entry = FindEntry(kFilePath3); | 1241 entry = FindEntry(kFilePath3); |
| 1198 ASSERT_TRUE(entry); | 1242 ASSERT_TRUE(entry); |
| 1199 EXPECT_EQ(kFilePath3, entry->GetFilePath()); | 1243 EXPECT_EQ(kFilePath3, entry->GetFilePath()); |
| 1244 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath3, entry)); |
| 1200 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); | 1245 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath3, entry->AsGDataFile())); |
| 1201 } | 1246 } |
| 1202 | 1247 |
| 1203 TEST_F(GDataFileSystemTest, SearchDuplicateNames) { | 1248 TEST_F(GDataFileSystemTest, SearchDuplicateNames) { |
| 1204 LoadRootFeedDocument("root_feed.json"); | 1249 LoadRootFeedDocument("root_feed.json"); |
| 1205 | 1250 |
| 1206 const FilePath kFilePath1 = FilePath( | 1251 const FilePath kFilePath1 = FilePath( |
| 1207 FILE_PATH_LITERAL("gdata/Duplicate Name.txt")); | 1252 FILE_PATH_LITERAL("gdata/Duplicate Name.txt")); |
| 1208 GDataEntry* entry = FindEntry(kFilePath1); | 1253 GDataEntry* entry = FindEntry(kFilePath1); |
| 1209 ASSERT_TRUE(entry); | 1254 ASSERT_TRUE(entry); |
| 1210 EXPECT_EQ(kFilePath1, entry->GetFilePath()); | 1255 EXPECT_EQ(kFilePath1, entry->GetFilePath()); |
| 1256 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath1, entry)); |
| 1211 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, entry->AsGDataFile())); | 1257 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath1, entry->AsGDataFile())); |
| 1212 | 1258 |
| 1213 const FilePath kFilePath2 = FilePath( | 1259 const FilePath kFilePath2 = FilePath( |
| 1214 FILE_PATH_LITERAL("gdata/Duplicate Name (2).txt")); | 1260 FILE_PATH_LITERAL("gdata/Duplicate Name (2).txt")); |
| 1215 entry = FindEntry(kFilePath2); | 1261 entry = FindEntry(kFilePath2); |
| 1216 ASSERT_TRUE(entry); | 1262 ASSERT_TRUE(entry); |
| 1217 EXPECT_EQ(kFilePath2, entry->GetFilePath()); | 1263 EXPECT_EQ(kFilePath2, entry->GetFilePath()); |
| 1264 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath2, entry)); |
| 1218 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); | 1265 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath2, entry->AsGDataFile())); |
| 1219 } | 1266 } |
| 1220 | 1267 |
| 1221 TEST_F(GDataFileSystemTest, SearchExistingDirectory) { | 1268 TEST_F(GDataFileSystemTest, SearchExistingDirectory) { |
| 1222 LoadRootFeedDocument("root_feed.json"); | 1269 LoadRootFeedDocument("root_feed.json"); |
| 1223 | 1270 |
| 1224 const FilePath kFilePath = FilePath( | 1271 const FilePath kFilePath = FilePath( |
| 1225 FILE_PATH_LITERAL("gdata/Directory 1")); | 1272 FILE_PATH_LITERAL("gdata/Directory 1")); |
| 1226 GDataEntry* entry = FindEntry(kFilePath); | 1273 GDataEntry* entry = FindEntry(kFilePath); |
| 1227 ASSERT_TRUE(entry); | 1274 ASSERT_TRUE(entry); |
| 1228 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1275 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1276 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1229 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); | 1277 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); |
| 1230 } | 1278 } |
| 1231 | 1279 |
| 1232 TEST_F(GDataFileSystemTest, SearchInSubdir) { | 1280 TEST_F(GDataFileSystemTest, SearchInSubdir) { |
| 1233 LoadRootFeedDocument("root_feed.json"); | 1281 LoadRootFeedDocument("root_feed.json"); |
| 1234 | 1282 |
| 1235 const FilePath kFilePath = FilePath( | 1283 const FilePath kFilePath = FilePath( |
| 1236 FILE_PATH_LITERAL("gdata/Directory 1/SubDirectory File 1.txt")); | 1284 FILE_PATH_LITERAL("gdata/Directory 1/SubDirectory File 1.txt")); |
| 1237 GDataEntry* entry = FindEntry(kFilePath); | 1285 GDataEntry* entry = FindEntry(kFilePath); |
| 1238 ASSERT_TRUE(entry); | 1286 ASSERT_TRUE(entry); |
| 1239 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1287 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1288 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1240 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); | 1289 EXPECT_TRUE(GetFileInfoAndCompare(kFilePath, entry->AsGDataFile())); |
| 1241 } | 1290 } |
| 1242 | 1291 |
| 1243 // Check the reconstruction of the directory structure from only the root feed. | 1292 // Check the reconstruction of the directory structure from only the root feed. |
| 1244 TEST_F(GDataFileSystemTest, SearchInSubSubdir) { | 1293 TEST_F(GDataFileSystemTest, SearchInSubSubdir) { |
| 1245 LoadRootFeedDocument("root_feed.json"); | 1294 LoadRootFeedDocument("root_feed.json"); |
| 1246 | 1295 |
| 1247 const FilePath kFilePath = FilePath( | 1296 const FilePath kFilePath = FilePath( |
| 1248 FILE_PATH_LITERAL("gdata/Directory 1/Sub Directory Folder/" | 1297 FILE_PATH_LITERAL("gdata/Directory 1/Sub Directory Folder/" |
| 1249 "Sub Sub Directory Folder")); | 1298 "Sub Sub Directory Folder")); |
| 1250 GDataEntry* entry = FindEntry(kFilePath); | 1299 GDataEntry* entry = FindEntry(kFilePath); |
| 1251 ASSERT_TRUE(entry); | 1300 ASSERT_TRUE(entry); |
| 1252 EXPECT_EQ(kFilePath, entry->GetFilePath()); | 1301 EXPECT_EQ(kFilePath, entry->GetFilePath()); |
| 1302 EXPECT_TRUE(GetEntryInfoAndCompare(kFilePath, entry)); |
| 1253 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); | 1303 EXPECT_TRUE(ReadDirectoryAndCompare(kFilePath, entry->AsGDataDirectory())); |
| 1254 } | 1304 } |
| 1255 | 1305 |
| 1256 TEST_F(GDataFileSystemTest, FilePathTests) { | 1306 TEST_F(GDataFileSystemTest, FilePathTests) { |
| 1257 LoadRootFeedDocument("root_feed.json"); | 1307 LoadRootFeedDocument("root_feed.json"); |
| 1258 | 1308 |
| 1259 FindAndTestFilePath(FilePath(FILE_PATH_LITERAL("gdata/File 1.txt"))); | 1309 FindAndTestFilePath(FilePath(FILE_PATH_LITERAL("gdata/File 1.txt"))); |
| 1260 FindAndTestFilePath(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))); | 1310 FindAndTestFilePath(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))); |
| 1261 FindAndTestFilePath( | 1311 FindAndTestFilePath( |
| 1262 FilePath(FILE_PATH_LITERAL("gdata/Directory 1/SubDirectory File 1.txt"))); | 1312 FilePath(FILE_PATH_LITERAL("gdata/Directory 1/SubDirectory File 1.txt"))); |
| (...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 EXPECT_EQ(1, num_callback_invocations_); | 3139 EXPECT_EQ(1, num_callback_invocations_); |
| 3090 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); | 3140 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); |
| 3091 | 3141 |
| 3092 // Try to remove the file. | 3142 // Try to remove the file. |
| 3093 num_callback_invocations_ = 0; | 3143 num_callback_invocations_ = 0; |
| 3094 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); | 3144 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); |
| 3095 EXPECT_EQ(1, num_callback_invocations_); | 3145 EXPECT_EQ(1, num_callback_invocations_); |
| 3096 } | 3146 } |
| 3097 | 3147 |
| 3098 } // namespace gdata | 3148 } // namespace gdata |
| OLD | NEW |