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 "chrome/browser/chromeos/drive/drive_test_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b) { | 32 bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b) { |
33 return (a.is_present() == b.is_present() && | 33 return (a.is_present() == b.is_present() && |
34 a.is_pinned() == b.is_pinned() && | 34 a.is_pinned() == b.is_pinned() && |
35 a.is_dirty() == b.is_dirty() && | 35 a.is_dirty() == b.is_dirty() && |
36 a.is_mounted() == b.is_mounted() && | 36 a.is_mounted() == b.is_mounted() && |
37 a.is_persistent() == b.is_persistent()); | 37 a.is_persistent() == b.is_persistent()); |
38 } | 38 } |
39 | 39 |
40 void CopyResultsFromGetAvailableSpaceCallback(DriveFileError* out_error, | |
41 int64* out_bytes_total, | |
42 int64* out_bytes_used, | |
43 DriveFileError error, | |
44 int64 bytes_total, | |
45 int64 bytes_used) { | |
46 DCHECK(out_error); | |
47 DCHECK(out_bytes_total); | |
48 DCHECK(out_bytes_used); | |
49 *out_error = error; | |
50 *out_bytes_total = bytes_total; | |
51 *out_bytes_used = bytes_used; | |
52 } | |
53 | |
54 void CopyResultsFromSearchMetadataCallback( | |
55 DriveFileError* out_error, | |
56 scoped_ptr<MetadataSearchResultVector>* out_result, | |
57 DriveFileError error, | |
58 scoped_ptr<MetadataSearchResultVector> result) { | |
59 DCHECK(out_error); | |
60 DCHECK(out_result); | |
61 | |
62 *out_error = error; | |
63 *out_result = result.Pass(); | |
64 } | |
65 | |
66 void CopyResultsFromOpenFileCallbackAndQuit(DriveFileError* out_error, | |
67 base::FilePath* out_file_path, | |
68 DriveFileError error, | |
69 const base::FilePath& file_path) { | |
70 *out_error = error; | |
71 *out_file_path = file_path; | |
72 MessageLoop::current()->Quit(); | |
73 } | |
74 | |
75 void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, | |
76 DriveFileError error) { | |
77 *out_error = error; | |
78 MessageLoop::current()->Quit(); | |
79 } | |
80 | |
81 bool LoadChangeFeed(const std::string& relative_path, | 40 bool LoadChangeFeed(const std::string& relative_path, |
82 ChangeListLoader* change_list_loader, | 41 ChangeListLoader* change_list_loader, |
83 bool is_delta_feed, | 42 bool is_delta_feed, |
84 const std::string& root_resource_id, | 43 const std::string& root_resource_id, |
85 int64 root_feed_changestamp) { | 44 int64 root_feed_changestamp) { |
86 scoped_ptr<Value> document = | 45 scoped_ptr<Value> document = |
87 google_apis::test_util::LoadJSONFile(relative_path); | 46 google_apis::test_util::LoadJSONFile(relative_path); |
88 if (!document.get()) | 47 if (!document.get()) |
89 return false; | 48 return false; |
90 if (document->GetType() != Value::TYPE_DICTIONARY) | 49 if (document->GetType() != Value::TYPE_DICTIONARY) |
(...skipping 18 matching lines...) Expand all Loading... |
109 is_delta_feed, | 68 is_delta_feed, |
110 base::Bind(&base::DoNothing)); | 69 base::Bind(&base::DoNothing)); |
111 // ChangeListLoader::UpdateFromFeed is asynchronous, so wait for it to finish. | 70 // ChangeListLoader::UpdateFromFeed is asynchronous, so wait for it to finish. |
112 google_apis::test_util::RunBlockingPoolTask(); | 71 google_apis::test_util::RunBlockingPoolTask(); |
113 | 72 |
114 return true; | 73 return true; |
115 } | 74 } |
116 | 75 |
117 } // namespace test_util | 76 } // namespace test_util |
118 } // namespace drive | 77 } // namespace drive |
OLD | NEW |