AU: Update Downloader to support our image formats.
The downloader used to be dumb in the sense that it would pipe output
to either a DirectFileWriter or a DirectFileWriter via a
GzipDecompressingFileWriter, depending on if we were downloading an
update that was compressed or not. Sadly, things have gotten more
complex: we need to download to two partitions (kernel + rootfs), and
we may stream data via a DeltaPerformer (a type of FileWriter) to the
disk. Thus, the Downloader streams to either
1. gzip decompress->split_writer->direct to disk OR
2. delta performer
Other misc changes: Change FilesystemCopierAction to support
optionally copying the kernel partition rather than root partition.
InstallPlan struct: add an entry for destiation kernel partition.
Test Utils: a new ScopedTempFile class
Utils: support for getting the booted kernel partition device.
BUG=None
TEST=attached unittests
Review URL: http://codereview.chromium.org/1694025
diff --git a/test_utils.h b/test_utils.h
index 4bc107e..ca797d9 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -9,8 +9,10 @@
#include <string>
#include <vector>
#include <gtest/gtest.h>
+#include "base/scoped_ptr.h"
#include "update_engine/action.h"
#include "update_engine/subprocess.h"
+#include "update_engine/utils.h"
// These are some handy functions for unittests.
@@ -119,6 +121,20 @@
DISALLOW_COPY_AND_ASSIGN(ScopedLoopbackDeviceReleaser);
};
+class ScopedTempFile {
+ public:
+ ScopedTempFile() {
+ EXPECT_TRUE(utils::MakeTempFile("/tmp/update_engine_test_temp_file.XXXXXX",
+ &path_,
+ NULL));
+ unlinker_.reset(new ScopedPathUnlinker(path_));
+ }
+ const std::string& GetPath() { return path_; }
+ private:
+ std::string path_;
+ scoped_ptr<ScopedPathUnlinker> unlinker_;
+};
+
// Useful actions for test
class NoneType;
@@ -191,4 +207,4 @@
} // namespace chromeos_update_engine
-#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
\ No newline at end of file
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__