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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 false, // load_from_server | 951 false, // load_from_server |
952 FilePath(FILE_PATH_LITERAL("drive")), | 952 FilePath(FILE_PATH_LITERAL("drive")), |
953 base::Bind(&GDataFileSystemTest::OnExpectToFindEntry, | 953 base::Bind(&GDataFileSystemTest::OnExpectToFindEntry, |
954 FilePath(FILE_PATH_LITERAL("drive")))); | 954 FilePath(FILE_PATH_LITERAL("drive")))); |
955 BrowserThread::GetBlockingPool()->FlushForTesting(); | 955 BrowserThread::GetBlockingPool()->FlushForTesting(); |
956 message_loop_.RunAllPending(); | 956 message_loop_.RunAllPending(); |
957 } | 957 } |
958 | 958 |
959 static void OnExpectToFindEntry(const FilePath& search_file_path, | 959 static void OnExpectToFindEntry(const FilePath& search_file_path, |
960 base::PlatformFileError error, | 960 base::PlatformFileError error, |
| 961 const FilePath& directory_path, |
961 GDataEntry* entry) { | 962 GDataEntry* entry) { |
962 ASSERT_TRUE(entry); | 963 ASSERT_TRUE(entry); |
963 ASSERT_EQ(search_file_path, entry->GetFilePath()); | 964 if (entry->file_info().is_directory) |
| 965 ASSERT_EQ(search_file_path, directory_path); |
| 966 else |
| 967 ASSERT_EQ(search_file_path, directory_path.Append(entry->file_name())); |
964 } | 968 } |
965 | 969 |
966 static Value* LoadJSONFile(const std::string& filename) { | 970 static Value* LoadJSONFile(const std::string& filename) { |
967 FilePath path = GetTestFilePath(filename); | 971 FilePath path = GetTestFilePath(filename); |
968 | 972 |
969 std::string error; | 973 std::string error; |
970 JSONFileValueSerializer serializer(path); | 974 JSONFileValueSerializer serializer(path); |
971 Value* value = serializer.Deserialize(NULL, &error); | 975 Value* value = serializer.Deserialize(NULL, &error); |
972 EXPECT_TRUE(value) << | 976 EXPECT_TRUE(value) << |
973 "Parse error " << path.value() << ": " << error; | 977 "Parse error " << path.value() << ": " << error; |
(...skipping 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3651 EXPECT_EQ(1, num_callback_invocations_); | 3655 EXPECT_EQ(1, num_callback_invocations_); |
3652 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); | 3656 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); |
3653 | 3657 |
3654 // Try to remove the file. | 3658 // Try to remove the file. |
3655 num_callback_invocations_ = 0; | 3659 num_callback_invocations_ = 0; |
3656 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); | 3660 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); |
3657 EXPECT_EQ(1, num_callback_invocations_); | 3661 EXPECT_EQ(1, num_callback_invocations_); |
3658 } | 3662 } |
3659 | 3663 |
3660 } // namespace gdata | 3664 } // namespace gdata |
OLD | NEW |