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