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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 TEST_F(GDataFileSystemTest, DuplicatedAsyncInitialization) { | 1191 TEST_F(GDataFileSystemTest, DuplicatedAsyncInitialization) { |
1192 int counter = 0; | 1192 int counter = 0; |
1193 ReadDirectoryCallback callback = base::Bind( | 1193 ReadDirectoryCallback callback = base::Bind( |
1194 &AsyncInitializationCallback, | 1194 &AsyncInitializationCallback, |
1195 &counter, | 1195 &counter, |
1196 2, | 1196 2, |
1197 FilePath(FILE_PATH_LITERAL("drive")), | 1197 FilePath(FILE_PATH_LITERAL("drive")), |
1198 &message_loop_); | 1198 &message_loop_); |
1199 | 1199 |
1200 EXPECT_CALL(*mock_doc_service_, GetAccountMetadata(_)).Times(1); | 1200 EXPECT_CALL(*mock_doc_service_, GetAccountMetadata(_)).Times(1); |
1201 EXPECT_CALL(*mock_doc_service_, GetDocuments(Eq(GURL()), _, _, _)).Times(1); | 1201 EXPECT_CALL(*mock_doc_service_, |
| 1202 GetDocuments(Eq(GURL()), _, _, _, _)).Times(1); |
1202 | 1203 |
1203 file_system_->ReadDirectoryByPathAsync( | 1204 file_system_->ReadDirectoryByPathAsync( |
1204 FilePath(FILE_PATH_LITERAL("drive")), callback); | 1205 FilePath(FILE_PATH_LITERAL("drive")), callback); |
1205 file_system_->ReadDirectoryByPathAsync( | 1206 file_system_->ReadDirectoryByPathAsync( |
1206 FilePath(FILE_PATH_LITERAL("drive")), callback); | 1207 FilePath(FILE_PATH_LITERAL("drive")), callback); |
1207 message_loop_.Run(); // Wait to get our result | 1208 message_loop_.Run(); // Wait to get our result |
1208 EXPECT_EQ(2, counter); | 1209 EXPECT_EQ(2, counter); |
1209 } | 1210 } |
1210 | 1211 |
1211 TEST_F(GDataFileSystemTest, SearchRootDirectory) { | 1212 TEST_F(GDataFileSystemTest, SearchRootDirectory) { |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 RunAllPendingForIO(); | 3199 RunAllPendingForIO(); |
3199 | 3200 |
3200 EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); | 3201 EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); |
3201 EXPECT_EQ(downloaded_file.value(), | 3202 EXPECT_EQ(downloaded_file.value(), |
3202 callback_helper_->download_path_.value()); | 3203 callback_helper_->download_path_.value()); |
3203 } | 3204 } |
3204 | 3205 |
3205 TEST_F(GDataFileSystemTest, ContentSearch) { | 3206 TEST_F(GDataFileSystemTest, ContentSearch) { |
3206 LoadRootFeedDocument("root_feed.json"); | 3207 LoadRootFeedDocument("root_feed.json"); |
3207 | 3208 |
3208 EXPECT_CALL(*mock_doc_service_, GetDocuments(Eq(GURL()), _, "foo", _)) | 3209 EXPECT_CALL(*mock_doc_service_, GetDocuments(Eq(GURL()), _, "foo", _, _)) |
3209 .Times(1); | 3210 .Times(1); |
3210 | 3211 |
3211 ReadDirectoryCallback callback = base::Bind( | 3212 ReadDirectoryCallback callback = base::Bind( |
3212 &ContentSearchCallback, | 3213 &ContentSearchCallback, |
3213 &message_loop_); | 3214 &message_loop_); |
3214 | 3215 |
3215 file_system_->SearchAsync("foo", callback); | 3216 file_system_->SearchAsync("foo", callback); |
3216 message_loop_.Run(); // Wait to get our result | 3217 message_loop_.Run(); // Wait to get our result |
3217 | 3218 |
3218 const SearchResultPair kSearchResultPairs[] = { | 3219 const SearchResultPair kSearchResultPairs[] = { |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3656 EXPECT_EQ(1, num_callback_invocations_); | 3657 EXPECT_EQ(1, num_callback_invocations_); |
3657 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); | 3658 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); |
3658 | 3659 |
3659 // Try to remove the file. | 3660 // Try to remove the file. |
3660 num_callback_invocations_ = 0; | 3661 num_callback_invocations_ = 0; |
3661 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); | 3662 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); |
3662 EXPECT_EQ(1, num_callback_invocations_); | 3663 EXPECT_EQ(1, num_callback_invocations_); |
3663 } | 3664 } |
3664 | 3665 |
3665 } // namespace gdata | 3666 } // namespace gdata |
OLD | NEW |