Index: src/platform/update_engine/test_utils.h |
diff --git a/src/platform/update_engine/test_utils.h b/src/platform/update_engine/test_utils.h |
index 4bc107e03e23ed41d50fdbb403e130e756a52281..ca797d96508c3870324d088207d7d91946a6cb58 100644 |
--- a/src/platform/update_engine/test_utils.h |
+++ b/src/platform/update_engine/test_utils.h |
@@ -9,8 +9,10 @@ |
#include <string> |
#include <vector> |
#include <gtest/gtest.h> |
+#include "base/scoped_ptr.h" |
#include "update_engine/action.h" |
#include "update_engine/subprocess.h" |
+#include "update_engine/utils.h" |
// These are some handy functions for unittests. |
@@ -119,6 +121,20 @@ class ScopedLoopbackDeviceReleaser { |
DISALLOW_COPY_AND_ASSIGN(ScopedLoopbackDeviceReleaser); |
}; |
+class ScopedTempFile { |
+ public: |
+ ScopedTempFile() { |
+ EXPECT_TRUE(utils::MakeTempFile("/tmp/update_engine_test_temp_file.XXXXXX", |
+ &path_, |
+ NULL)); |
+ unlinker_.reset(new ScopedPathUnlinker(path_)); |
+ } |
+ const std::string& GetPath() { return path_; } |
+ private: |
+ std::string path_; |
+ scoped_ptr<ScopedPathUnlinker> unlinker_; |
+}; |
+ |
// Useful actions for test |
class NoneType; |
@@ -191,4 +207,4 @@ struct ObjectCollectorAction : public Action<ObjectCollectorAction<T> > { |
} // namespace chromeos_update_engine |
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ |
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ |