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

Side by Side Diff: chrome/browser/chromeos/drive/resource_metadata_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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
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 "chrome/browser/chromeos/drive/resource_metadata.h" 5 #include "chrome/browser/chromeos/drive/resource_metadata.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 google_apis::test_util::RunBlockingPoolTask(); 209 google_apis::test_util::RunBlockingPoolTask();
210 return result; 210 return result;
211 } 211 }
212 212
213 base::ScopedTempDir temp_dir_; 213 base::ScopedTempDir temp_dir_;
214 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 214 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
215 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> 215 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests>
216 resource_metadata_; 216 resource_metadata_;
217 217
218 private: 218 private:
219 MessageLoopForUI message_loop_; 219 base::MessageLoopForUI message_loop_;
220 content::TestBrowserThread ui_thread_; 220 content::TestBrowserThread ui_thread_;
221 }; 221 };
222 222
223 TEST_F(ResourceMetadataTestOnUIThread, LargestChangestamp) { 223 TEST_F(ResourceMetadataTestOnUIThread, LargestChangestamp) {
224 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> 224 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests>
225 resource_metadata(new ResourceMetadata(temp_dir_.path(), 225 resource_metadata(new ResourceMetadata(temp_dir_.path(),
226 blocking_task_runner_)); 226 blocking_task_runner_));
227 FileError error = FILE_ERROR_FAILED; 227 FileError error = FILE_ERROR_FAILED;
228 resource_metadata->Initialize( 228 resource_metadata->Initialize(
229 google_apis::test_util::CreateCopyResultCallback(&error)); 229 google_apis::test_util::CreateCopyResultCallback(&error));
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 message_loop_.RunUntilIdle(); 1191 message_loop_.RunUntilIdle();
1192 ASSERT_EQ(FILE_ERROR_OK, error); 1192 ASSERT_EQ(FILE_ERROR_OK, error);
1193 1193
1194 SetUpEntries(resource_metadata_.get()); 1194 SetUpEntries(resource_metadata_.get());
1195 } 1195 }
1196 1196
1197 virtual void TearDown() OVERRIDE { 1197 virtual void TearDown() OVERRIDE {
1198 } 1198 }
1199 1199
1200 base::ScopedTempDir temp_dir_; 1200 base::ScopedTempDir temp_dir_;
1201 MessageLoopForUI message_loop_; 1201 base::MessageLoopForUI message_loop_;
1202 content::TestBrowserThread ui_thread_; 1202 content::TestBrowserThread ui_thread_;
1203 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> 1203 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests>
1204 resource_metadata_; 1204 resource_metadata_;
1205 }; 1205 };
1206 1206
1207 TEST_F(ResourceMetadataTest, Iterate) { 1207 TEST_F(ResourceMetadataTest, Iterate) {
1208 scoped_ptr<ResourceMetadata::Iterator> it = resource_metadata_->GetIterator(); 1208 scoped_ptr<ResourceMetadata::Iterator> it = resource_metadata_->GetIterator();
1209 ASSERT_TRUE(it); 1209 ASSERT_TRUE(it);
1210 1210
1211 int file_count = 0, directory_count = 0; 1211 int file_count = 0, directory_count = 0;
1212 for (; !it->IsAtEnd(); it->Advance()) { 1212 for (; !it->IsAtEnd(); it->Advance()) {
1213 if (!it->Get().file_info().is_directory()) 1213 if (!it->Get().file_info().is_directory())
1214 ++file_count; 1214 ++file_count;
1215 else 1215 else
1216 ++directory_count; 1216 ++directory_count;
1217 } 1217 }
1218 1218
1219 EXPECT_EQ(7, file_count); 1219 EXPECT_EQ(7, file_count);
1220 EXPECT_EQ(6, directory_count); 1220 EXPECT_EQ(6, directory_count);
1221 } 1221 }
1222 1222
1223 } // namespace internal 1223 } // namespace internal
1224 } // namespace drive 1224 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698