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

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: Addressed code review feedbacks 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
« no previous file with comments | « metadata_unittest.cc ('k') | test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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__
« no previous file with comments | « metadata_unittest.cc ('k') | test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698