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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_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/file_system.h" 5 #include "chrome/browser/chromeos/drive/file_system.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const int64 kLotsOfSpace = internal::kMinFreeSpace * 10; 45 const int64 kLotsOfSpace = internal::kMinFreeSpace * 10;
46 46
47 struct SearchResultPair { 47 struct SearchResultPair {
48 const char* path; 48 const char* path;
49 const bool is_directory; 49 const bool is_directory;
50 }; 50 };
51 51
52 // Callback to FileSystem::Search used in ContentSearch tests. 52 // Callback to FileSystem::Search used in ContentSearch tests.
53 // Verifies returned vector of results and next feed url. 53 // Verifies returned vector of results and next feed url.
54 void DriveSearchCallback( 54 void DriveSearchCallback(
55 MessageLoop* message_loop, 55 base::MessageLoop* message_loop,
56 const SearchResultPair* expected_results, 56 const SearchResultPair* expected_results,
57 size_t expected_results_size, 57 size_t expected_results_size,
58 const GURL& expected_next_feed, 58 const GURL& expected_next_feed,
59 FileError error, 59 FileError error,
60 const GURL& next_feed, 60 const GURL& next_feed,
61 scoped_ptr<std::vector<SearchResultInfo> > results) { 61 scoped_ptr<std::vector<SearchResultInfo> > results) {
62 ASSERT_TRUE(results); 62 ASSERT_TRUE(results);
63 ASSERT_EQ(expected_results_size, results->size()); 63 ASSERT_EQ(expected_results_size, results->size());
64 64
65 for (size_t i = 0; i < results->size(); i++) { 65 for (size_t i = 0; i < results->size(); i++) {
(...skipping 14 matching lines...) Expand all
80 for (size_t i = 0; i < entries.size(); ++i) { 80 for (size_t i = 0; i < entries.size(); ++i) {
81 if (!entries[i].file_info().is_directory()) 81 if (!entries[i].file_info().is_directory())
82 ++num_files; 82 ++num_files;
83 } 83 }
84 return num_files; 84 return num_files;
85 } 85 }
86 86
87 // Counts the number of invocation, and if it increased up to |expected_counter| 87 // Counts the number of invocation, and if it increased up to |expected_counter|
88 // quits the current message loop. 88 // quits the current message loop.
89 void AsyncInitializationCallback( 89 void AsyncInitializationCallback(
90 int* counter, int expected_counter, MessageLoop* message_loop, 90 int* counter, int expected_counter, base::MessageLoop* message_loop,
91 FileError error, scoped_ptr<ResourceEntry> entry) { 91 FileError error, scoped_ptr<ResourceEntry> entry) {
92 if (error != FILE_ERROR_OK || !entry) { 92 if (error != FILE_ERROR_OK || !entry) {
93 // If we hit an error case, quit the message loop immediately. 93 // If we hit an error case, quit the message loop immediately.
94 // Then the expectation in the test case can find it because the actual 94 // Then the expectation in the test case can find it because the actual
95 // value of |counter| is different from the expected one. 95 // value of |counter| is different from the expected one.
96 message_loop->Quit(); 96 message_loop->Quit();
97 return; 97 return;
98 } 98 }
99 99
100 (*counter)++; 100 (*counter)++;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 ASSERT_TRUE(value->GetAsDictionary(&dict_value)); 426 ASSERT_TRUE(value->GetAsDictionary(&dict_value));
427 427
428 std::string alternate_url, resource_id; 428 std::string alternate_url, resource_id;
429 EXPECT_TRUE(dict_value->GetString("url", &alternate_url)); 429 EXPECT_TRUE(dict_value->GetString("url", &alternate_url));
430 EXPECT_TRUE(dict_value->GetString("resource_id", &resource_id)); 430 EXPECT_TRUE(dict_value->GetString("resource_id", &resource_id));
431 431
432 EXPECT_EQ(entry.file_specific_info().alternate_url(), alternate_url); 432 EXPECT_EQ(entry.file_specific_info().alternate_url(), alternate_url);
433 EXPECT_EQ(entry.resource_id(), resource_id); 433 EXPECT_EQ(entry.resource_id(), resource_id);
434 } 434 }
435 435
436 MessageLoopForUI message_loop_; 436 base::MessageLoopForUI message_loop_;
437 content::TestBrowserThread ui_thread_; 437 content::TestBrowserThread ui_thread_;
438 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 438 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
439 scoped_ptr<TestingProfile> profile_; 439 scoped_ptr<TestingProfile> profile_;
440 440
441 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_; 441 scoped_ptr<internal::FileCache, test_util::DestroyHelperForTests> cache_;
442 scoped_ptr<FileSystem> file_system_; 442 scoped_ptr<FileSystem> file_system_;
443 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; 443 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_;
444 scoped_ptr<JobScheduler> scheduler_; 444 scoped_ptr<JobScheduler> scheduler_;
445 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> 445 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests>
446 resource_metadata_; 446 resource_metadata_;
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 entry->resource_id(), 1986 entry->resource_id(),
1987 entry->file_specific_info().file_md5(), 1987 entry->file_specific_info().file_md5(),
1988 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); 1988 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry));
1989 google_apis::test_util::RunBlockingPoolTask(); 1989 google_apis::test_util::RunBlockingPoolTask();
1990 1990
1991 EXPECT_TRUE(success); 1991 EXPECT_TRUE(success);
1992 EXPECT_FALSE(cache_entry.is_mounted()); 1992 EXPECT_FALSE(cache_entry.is_mounted());
1993 } 1993 }
1994 1994
1995 } // namespace drive 1995 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698