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

Unified Diff: src/platform/update_engine/test_utils.h

Issue 1718001: AU: Class to perform delta updates. (Closed)
Patch Set: fixes for review Created 10 years, 8 months 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: 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;

Powered by Google App Engine
This is Rietveld 408576698