Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc

Issue 10263023: gdata: Remove use of FindEntryByPathAsync() from gdata_file_system_unittest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 1068
1069 int num_callback_invocations_; 1069 int num_callback_invocations_;
1070 base::PlatformFileError expected_error_; 1070 base::PlatformFileError expected_error_;
1071 int expected_cache_state_; 1071 int expected_cache_state_;
1072 GDataRootDirectory::CacheSubDirectoryType expected_sub_dir_type_; 1072 GDataRootDirectory::CacheSubDirectoryType expected_sub_dir_type_;
1073 bool expect_outgoing_symlink_; 1073 bool expect_outgoing_symlink_;
1074 std::string expected_file_extension_; 1074 std::string expected_file_extension_;
1075 int root_feed_changestamp_; 1075 int root_feed_changestamp_;
1076 }; 1076 };
1077 1077
1078 void AsyncInitializationCallback(int* counter, 1078 void AsyncInitializationCallback(
1079 int expected_counter, 1079 int* counter,
1080 const FilePath& expected_file_path, 1080 int expected_counter,
1081 MessageLoop* message_loop, 1081 const FilePath& expected_file_path,
1082 base::PlatformFileError error, 1082 MessageLoop* message_loop,
1083 const FilePath& directory_path, 1083 base::PlatformFileError error,
1084 GDataEntry* entry) { 1084 scoped_ptr<GDataDirectoryProto> directory_proto) {
1085 LOG(INFO) << "here";
1086 ASSERT_EQ(base::PLATFORM_FILE_OK, error); 1085 ASSERT_EQ(base::PLATFORM_FILE_OK, error);
1087 EXPECT_EQ(expected_file_path, directory_path); 1086 ASSERT_TRUE(directory_proto.get());
1088 EXPECT_FALSE(entry == NULL); 1087 EXPECT_EQ(expected_file_path.value(),
1088 directory_proto->gdata_entry().file_name());
1089 1089
1090 (*counter)++; 1090 (*counter)++;
1091 if (*counter >= expected_counter) 1091 if (*counter >= expected_counter)
1092 message_loop->Quit(); 1092 message_loop->Quit();
1093 } 1093 }
1094 1094
1095 TEST_F(GDataFileSystemTest, DuplicatedAsyncInitialization) { 1095 TEST_F(GDataFileSystemTest, DuplicatedAsyncInitialization) {
1096 int counter = 0; 1096 int counter = 0;
1097 FindEntryCallback callback = base::Bind( 1097 ReadDirectoryCallback callback = base::Bind(
1098 &AsyncInitializationCallback, 1098 &AsyncInitializationCallback,
1099 &counter, 1099 &counter,
1100 2, 1100 2,
1101 FilePath(FILE_PATH_LITERAL("gdata")), 1101 FilePath(FILE_PATH_LITERAL("gdata")),
1102 &message_loop_); 1102 &message_loop_);
1103 1103
1104 EXPECT_CALL(*mock_doc_service_, GetAccountMetadata(_)).Times(1); 1104 EXPECT_CALL(*mock_doc_service_, GetAccountMetadata(_)).Times(1);
1105 EXPECT_CALL(*mock_doc_service_, GetDocuments(Eq(GURL()), _, _)).Times(1); 1105 EXPECT_CALL(*mock_doc_service_, GetDocuments(Eq(GURL()), _, _)).Times(1);
1106 1106
1107 file_system_->FindEntryByPathAsync( 1107 file_system_->ReadDirectoryByPathAsync(
1108 FilePath(FILE_PATH_LITERAL("gdata")), callback); 1108 FilePath(FILE_PATH_LITERAL("gdata")), callback);
1109 file_system_->FindEntryByPathAsync( 1109 file_system_->ReadDirectoryByPathAsync(
1110 FilePath(FILE_PATH_LITERAL("gdata")), callback); 1110 FilePath(FILE_PATH_LITERAL("gdata")), callback);
1111 message_loop_.Run(); // Wait to get our result 1111 message_loop_.Run(); // Wait to get our result
1112 EXPECT_EQ(2, counter); 1112 EXPECT_EQ(2, counter);
1113 } 1113 }
1114 1114
1115 TEST_F(GDataFileSystemTest, SearchRootDirectory) { 1115 TEST_F(GDataFileSystemTest, SearchRootDirectory) {
1116 LoadRootFeedDocument("root_feed.json"); 1116 LoadRootFeedDocument("root_feed.json");
1117 1117
1118 const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("gdata")); 1118 const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("gdata"));
1119 GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath))); 1119 GDataEntry* entry = FindEntry(FilePath(FILE_PATH_LITERAL(kFilePath)));
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 EXPECT_EQ(1, num_callback_invocations_); 3089 EXPECT_EQ(1, num_callback_invocations_);
3090 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); 3090 EXPECT_TRUE(CacheEntryExists(resource_id, md5));
3091 3091
3092 // Try to remove the file. 3092 // Try to remove the file.
3093 num_callback_invocations_ = 0; 3093 num_callback_invocations_ = 0;
3094 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); 3094 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK);
3095 EXPECT_EQ(1, num_callback_invocations_); 3095 EXPECT_EQ(1, num_callback_invocations_);
3096 } 3096 }
3097 3097
3098 } // namespace gdata 3098 } // namespace gdata
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698