Chromium Code Reviews| 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 bba3ed1b68215729893fb5db046f3a19d39f048f..fe0f4886c260bdba8a500f0fc84d1eded002ab1f 100644 | 
| --- a/src/platform/update_engine/test_utils.h | 
| +++ b/src/platform/update_engine/test_utils.h | 
| @@ -10,6 +10,7 @@ | 
| #include <vector> | 
| #include <gtest/gtest.h> | 
| #include "update_engine/action.h" | 
| +#include "update_engine/subprocess.h" | 
| // These are some handy functions for unittests. | 
| @@ -105,6 +106,22 @@ void CreateExtImageAtPath(const std::string& path, | 
| void VerifyAllPaths(const std::string& parent, | 
| std::set<std::string> expected_paths); | 
| +class ScopedLoopbackDeviceReleaser { | 
| + public: | 
| + explicit ScopedLoopbackDeviceReleaser(const std::string& dev) : dev_(dev) {} | 
| + ~ScopedLoopbackDeviceReleaser() { | 
| + std::vector<std::string> args; | 
| + args.push_back("/sbin/losetup"); | 
| + args.push_back("-d"); | 
| + args.push_back(dev_); | 
| + int return_code = 0; | 
| + EXPECT_TRUE(Subprocess::SynchronousExec(args, &return_code)); | 
| + EXPECT_EQ(0, return_code); | 
| + } | 
| + private: | 
| + const std::string dev_; | 
| 
 
Daniel Erat
2010/04/23 17:47:25
add DISALLOW_COPY_AND_ASSIGN (especially for RAII-
 
adlr
2010/04/23 20:50:17
Done.
 
 | 
| +}; | 
| + | 
| // Useful actions for test | 
| class NoneType; |