Index: chrome/browser/chromeos/drive/drive_test_util.h |
diff --git a/chrome/browser/chromeos/drive/drive_test_util.h b/chrome/browser/chromeos/drive/drive_test_util.h |
index 03fb3d93124f67a5e37525b77f83e49dca814200..72b79b1935e48caf5f624a16cecd066edc5c13ff 100644 |
--- a/chrome/browser/chromeos/drive/drive_test_util.h |
+++ b/chrome/browser/chromeos/drive/drive_test_util.h |
@@ -169,9 +169,19 @@ bool LoadChangeFeed(const std::string& relative_path, |
bool is_delta_feed, |
int64 root_feed_changestamp); |
-// DriveCache has private destructor, so it is impossible to delete the |
-// instance directly. This method delete it correctly. |
-void DeleteDriveCache(DriveCache* drive_cache); |
+// Helper to destroy objects which needs Destroy() to be called on destruction. |
hidehiko
2013/03/18 13:16:28
How about adding comment that it is necessary to i
hashimoto
2013/03/18 13:40:10
It's not necessary as long as the blocking task ru
hidehiko
2013/03/18 13:57:44
I understand.
Could you add short comment about it
hashimoto
2013/03/18 15:15:34
Added a note.
|
+template<typename T> |
+struct DestroyHelperForTests { |
hidehiko
2013/03/18 13:16:28
ditto.
hashimoto
2013/03/18 13:40:10
Done.
|
+ // scoped_ptr for T which calls Destroy() and RunBlockingPoolTask() on |
+ // destruction. |
+ typedef scoped_ptr<T, DestroyHelperForTests<T> > scoped_ptr; |
+ |
+ void operator()(T* object) const { |
+ if (object) |
+ object->Destroy(); |
+ google_apis::test_util::RunBlockingPoolTask(); // Finish destruction. |
+ } |
+}; |
} // namespace test_util |
} // namespace drive |