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