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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 9 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
10 #include "chrome/browser/chromeos/drive/search_metadata.h" | 10 #include "chrome/browser/chromeos/drive/search_metadata.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, | 162 void CopyResultsFromCloseFileCallbackAndQuit(DriveFileError* out_error, |
163 DriveFileError error); | 163 DriveFileError error); |
164 | 164 |
165 // Loads a test json file as root ("/drive") element from a test file stored | 165 // Loads a test json file as root ("/drive") element from a test file stored |
166 // under chrome/test/data/chromeos. Returns true on success. | 166 // under chrome/test/data/chromeos. Returns true on success. |
167 bool LoadChangeFeed(const std::string& relative_path, | 167 bool LoadChangeFeed(const std::string& relative_path, |
168 ChangeListLoader* change_list_loader, | 168 ChangeListLoader* change_list_loader, |
169 bool is_delta_feed, | 169 bool is_delta_feed, |
170 int64 root_feed_changestamp); | 170 int64 root_feed_changestamp); |
171 | 171 |
172 // DriveCache has private destructor, so it is impossible to delete the | 172 // Helper to destroy objects which needs Destroy() to be called on destruction. |
173 // instance directly. This method delete it correctly. | 173 // Note: When using this helper, you should destruct objects before |
174 void DeleteDriveCache(DriveCache* drive_cache); | 174 // BrowserThread. |
| 175 struct DestroyHelperForTests { |
| 176 template<typename T> |
| 177 void operator()(T* object) const { |
| 178 if (object) { |
| 179 object->Destroy(); |
| 180 google_apis::test_util::RunBlockingPoolTask(); // Finish destruction. |
| 181 } |
| 182 } |
| 183 }; |
175 | 184 |
176 } // namespace test_util | 185 } // namespace test_util |
177 } // namespace drive | 186 } // namespace drive |
178 | 187 |
179 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ | 188 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_TEST_UTIL_H_ |
OLD | NEW |