Chromium Code Reviews| Index: test_utils.h |
| diff --git a/test_utils.h b/test_utils.h |
| index 4c8288892b37eb82dd4e904d0f40b62965efa8ee..fa6da80dfb9078b36b682f908b8833c2c8ee642c 100644 |
| --- a/test_utils.h |
| +++ b/test_utils.h |
| @@ -8,8 +8,11 @@ |
| #include <set> |
| #include <string> |
| #include <vector> |
| + |
| +#include <base/scoped_ptr.h> |
| +#include <base/string_util.h> |
|
petkov
2010/12/15 18:40:32
do you need this header file here? can it be moved
thieule
2010/12/15 19:57:01
Done.
|
| #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 +95,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 +219,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: |
| + // 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__ |