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

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

Issue 551132: AU: Extent writer utility classes (Closed)
Patch Set: fixes for review Created 10 years, 11 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.cc
diff --git a/src/platform/update_engine/test_utils.cc b/src/platform/update_engine/test_utils.cc
index f83ddf98d1ba33cad0ff6697012cac67df92b0ee..6c1e35bd98736c7580a2b355353625633f784477 100644
--- a/src/platform/update_engine/test_utils.cc
+++ b/src/platform/update_engine/test_utils.cc
@@ -165,16 +165,25 @@ std::string GetUnusedLoopDevice() {
return ret;
}
-bool ExpectVectorsEq(const vector<char>& a, const vector<char>& b) {
- EXPECT_EQ(a.size(), b.size());
- if (a.size() != b.size())
+bool ExpectVectorsEq(const vector<char>& expected, const vector<char>& actual) {
+ EXPECT_EQ(expected.size(), actual.size());
+ if (expected.size() != actual.size())
return false;
- for (unsigned int i = 0; i < a.size(); i++) {
- EXPECT_EQ(a[i], b[i]) << "offset: " << i;
+ for (unsigned int i = 0; i < expected.size(); i++) {
+ EXPECT_EQ(expected[i], actual[i]) << "offset: " << i;
}
return true;
}
+void FillWithData(vector<char>* buffer) {
+ size_t input_counter = 0;
+ for (vector<char>::iterator it = buffer->begin(); it != buffer->end(); ++it) {
+ *it = kRandomString[input_counter];
+ input_counter++;
+ input_counter %= sizeof(kRandomString);
+ }
+}
+
void CreateExtImageAtPath(const string& path, vector<string>* out_paths) {
// create 10MiB sparse file
EXPECT_EQ(0, System(StringPrintf("dd if=/dev/zero of=%s"

Powered by Google App Engine
This is Rietveld 408576698