Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: test_utils.h

Issue 5684002: Add support for bsdiff of file system metadata blocks (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Forgot newly added metadata processing files. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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__

Powered by Google App Engine
This is Rietveld 408576698