Chromium Code Reviews| Index: test_utils.h |
| diff --git a/test_utils.h b/test_utils.h |
| index 4c8288892b37eb82dd4e904d0f40b62965efa8ee..68de48d7143836dfa273ebec5465a93b65dcc3f2 100644 |
| --- a/test_utils.h |
| +++ b/test_utils.h |
| @@ -8,8 +8,10 @@ |
| #include <set> |
| #include <string> |
| #include <vector> |
| + |
| +#include <base/scoped_ptr.h> |
| #include <gtest/gtest.h> |
| -#include "base/scoped_ptr.h" |
| + |
| #include "update_engine/action.h" |
| #include "update_engine/subprocess.h" |
| #include "update_engine/utils.h" |
| @@ -92,6 +94,11 @@ const unsigned char kRandomString[] = { |
| const char* const kMountPath = "/tmp/UpdateEngineTests_mnt"; |
| } // namespace {} |
| +// Creates an empty ext image. |
| +void CreateEmptyExtImageAtPath(const std::string& path, |
| + size_t size, |
| + int block_size); |
| + |
| // Creates an ext image with some files in it. The paths creates are |
| // returned in out_paths. |
| void CreateExtImageAtPath(const std::string& path, |
| @@ -211,6 +218,22 @@ struct ObjectCollectorAction : public Action<ObjectCollectorAction<T> > { |
| T object_; |
| }; |
| +class ScopedLoopMounter { |
| + public: |
| + explicit ScopedLoopMounter(const std::string& file_path, |
| + std::string* mnt_path, |
| + unsigned long flags); |
| + |
| + private: |
| + // These objects must be destructed in the following order: |
|
petkov
2010/12/15 23:30:16
Does C++ standard ensure the destruction order?
thieule
2010/12/15 23:43:39
Yes, nonstatic members are destroyed in reverse or
|
| + // ScopedFilesystemUnmounter (the file system must be unmounted first) |
| + // ScopedLoopbackDeviceReleaser (then the loop device can be deleted) |
| + // ScopedDirRemover (then the mount point can be deleted) |
| + scoped_ptr<ScopedDirRemover> dir_remover_; |
| + scoped_ptr<ScopedLoopbackDeviceReleaser> loop_releaser_; |
| + scoped_ptr<ScopedFilesystemUnmounter> unmounter_; |
| +}; |
| + |
| } // namespace chromeos_update_engine |
| #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__ |