update_engine: Merge remote-tracking branch 'cros/upstream' into cros/master
Since libchrome in AOSP is ahead of CrOS I had to guard against BASE_VER in a
few places to satisfy older libchromes.
file_fetcher.cc is now needed in delta_generator.
A few unittests need to be run as root.
BUG=chromium:916593
TEST=unittest
TEST=cros_generate_update_payload
TEST=cros flash
CQ-DEPEND=CL:1399261
Change-Id: If3497549e88e559f8ecc38f414259b9c774f4a44
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index 1e61db7..d172885 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -20,6 +20,7 @@
#include <string>
#include <base/bind.h>
+#include <base/bind_helpers.h>
#include <brillo/message_loops/fake_message_loop.h>
#include <brillo/message_loops/message_loop_utils.h>
#include <gtest/gtest.h>
@@ -48,8 +49,6 @@
namespace {
-void DoNothing() {}
-
// Sets the value of the passed pointer to true.
void SetTrue(bool* value) {
*value = true;
@@ -207,7 +206,13 @@
fake_const_var_.reset(new string("Hello world!"));
EXPECT_EQ(*eval_ctx_->GetValue(&fake_const_var_), "Hello world!");
- EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
// Test that reevaluation occurs when an async variable it depends on changes.
@@ -277,11 +282,23 @@
EXPECT_TRUE(value);
// Ensure that we cannot reschedule an evaluation.
- EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
// Ensure that we can reschedule an evaluation after resetting expiration.
eval_ctx_->ResetExpiration();
- EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
// Test that we clear the events when destroying the EvaluationContext.
@@ -327,7 +344,13 @@
fake_poll_var_.reset(new string("Polled value"));
eval_ctx_->GetValue(&fake_async_var_);
eval_ctx_->GetValue(&fake_poll_var_);
- EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
// TearDown() checks for leaked observers on this async_variable, which means
// that our object is still alive after removing its reference.
}
@@ -420,7 +443,13 @@
// The "false" from IsWallclockTimeGreaterThan means that's not that timestamp
// yet, so this should schedule a callback for when that happens.
- EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
TEST_F(UmEvaluationContextTest,
@@ -430,7 +459,13 @@
// The "false" from IsMonotonicTimeGreaterThan means that's not that timestamp
// yet, so this should schedule a callback for when that happens.
- EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_TRUE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
TEST_F(UmEvaluationContextTest,
@@ -443,7 +478,13 @@
fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1)));
// Callback should not be scheduled.
- EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
TEST_F(UmEvaluationContextTest,
@@ -456,7 +497,13 @@
fake_clock_.GetMonotonicTime() - TimeDelta::FromSeconds(1)));
// Callback should not be scheduled.
- EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(Bind(&DoNothing)));
+ EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(
+#if BASE_VER < 576279
+ Bind(&base::DoNothing)
+#else
+ base::DoNothing()
+#endif
+ ));
}
TEST_F(UmEvaluationContextTest, DumpContext) {