Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include <gtest/gtest.h> |
| 6 | |
| 7 | #include "update_engine/update_attempter_mock.h" |
| 8 | #include "update_engine/update_check_scheduler.h" |
| 9 | |
| 10 | using std::string; |
| 11 | using testing::_; |
| 12 | using testing::AllOf; |
Darin Petkov | 2a0e633 | 2010-09-24 14:43:41 -0700 | [diff] [blame] | 13 | using testing::Assign; |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 14 | using testing::Ge; |
| 15 | using testing::Le; |
| 16 | using testing::MockFunction; |
| 17 | using testing::Return; |
| 18 | |
| 19 | namespace chromeos_update_engine { |
| 20 | |
| 21 | namespace { |
| 22 | void FuzzRange(int interval, int fuzz, int* interval_min, int* interval_max) { |
| 23 | *interval_min = interval - fuzz / 2; |
| 24 | *interval_max = interval + fuzz - fuzz / 2; |
| 25 | } |
| 26 | } // namespace {} |
| 27 | |
| 28 | // Test a subclass rather than the main class directly so that we can mock out |
| 29 | // GLib and utils in tests. There're explicit unit test for the wrapper methods. |
| 30 | class UpdateCheckSchedulerUnderTest : public UpdateCheckScheduler { |
| 31 | public: |
| 32 | UpdateCheckSchedulerUnderTest(UpdateAttempter* update_attempter) |
| 33 | : UpdateCheckScheduler(update_attempter) {} |
| 34 | |
| 35 | MOCK_METHOD2(GTimeoutAddSeconds, guint(guint seconds, GSourceFunc function)); |
| 36 | MOCK_METHOD0(IsBootDeviceRemovable, bool()); |
| 37 | MOCK_METHOD0(IsOfficialBuild, bool()); |
Darin Petkov | 2a0e633 | 2010-09-24 14:43:41 -0700 | [diff] [blame] | 38 | MOCK_METHOD0(IsOOBEComplete, bool()); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | class UpdateCheckSchedulerTest : public ::testing::Test { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 42 | public: |
| 43 | UpdateCheckSchedulerTest() : scheduler_(&attempter_) {} |
| 44 | |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 45 | protected: |
| 46 | virtual void SetUp() { |
| 47 | test_ = this; |
| 48 | loop_ = NULL; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 49 | EXPECT_EQ(&attempter_, scheduler_.update_attempter_); |
| 50 | EXPECT_FALSE(scheduler_.enabled_); |
| 51 | EXPECT_FALSE(scheduler_.scheduled_); |
| 52 | EXPECT_EQ(0, scheduler_.last_interval_); |
Darin Petkov | 85ced13 | 2010-09-01 10:20:56 -0700 | [diff] [blame] | 53 | EXPECT_EQ(0, scheduler_.poll_interval_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | virtual void TearDown() { |
| 57 | test_ = NULL; |
| 58 | loop_ = NULL; |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static gboolean SourceCallback(gpointer data) { |
| 62 | g_main_loop_quit(test_->loop_); |
| 63 | // Forwards the call to the function mock so that expectations can be set. |
| 64 | return test_->source_callback_.Call(data); |
| 65 | } |
| 66 | |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 67 | UpdateCheckSchedulerUnderTest scheduler_; |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 68 | UpdateAttempterMock attempter_; |
| 69 | MockFunction<gboolean(gpointer data)> source_callback_; |
| 70 | GMainLoop* loop_; |
| 71 | static UpdateCheckSchedulerTest* test_; |
| 72 | }; |
| 73 | |
| 74 | UpdateCheckSchedulerTest* UpdateCheckSchedulerTest::test_ = NULL; |
| 75 | |
| 76 | TEST_F(UpdateCheckSchedulerTest, CanScheduleTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 77 | EXPECT_FALSE(scheduler_.CanSchedule()); |
| 78 | scheduler_.enabled_ = true; |
| 79 | EXPECT_TRUE(scheduler_.CanSchedule()); |
| 80 | scheduler_.scheduled_ = true; |
| 81 | EXPECT_FALSE(scheduler_.CanSchedule()); |
| 82 | scheduler_.enabled_ = false; |
| 83 | EXPECT_FALSE(scheduler_.CanSchedule()); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | TEST_F(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzBackoffTest) { |
| 87 | int interval, fuzz; |
| 88 | attempter_.set_http_response_code(500); |
| 89 | int last_interval = UpdateCheckScheduler::kTimeoutPeriodic + 50; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 90 | scheduler_.last_interval_ = last_interval; |
| 91 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 92 | EXPECT_EQ(2 * last_interval, interval); |
| 93 | EXPECT_EQ(2 * last_interval, fuzz); |
| 94 | |
| 95 | attempter_.set_http_response_code(503); |
Darin Petkov | 85ced13 | 2010-09-01 10:20:56 -0700 | [diff] [blame] | 96 | scheduler_.last_interval_ = UpdateCheckScheduler::kTimeoutMaxBackoff / 2 + 1; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 97 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 98 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutMaxBackoff, interval); |
| 99 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutMaxBackoff, fuzz); |
| 100 | } |
| 101 | |
Darin Petkov | 85ced13 | 2010-09-01 10:20:56 -0700 | [diff] [blame] | 102 | TEST_F(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzPollTest) { |
| 103 | int interval, fuzz; |
| 104 | int poll_interval = UpdateCheckScheduler::kTimeoutPeriodic + 50; |
| 105 | scheduler_.set_poll_interval(poll_interval); |
| 106 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
| 107 | EXPECT_EQ(poll_interval, interval); |
| 108 | EXPECT_EQ(poll_interval, fuzz); |
| 109 | |
| 110 | scheduler_.set_poll_interval(UpdateCheckScheduler::kTimeoutMaxBackoff + 1); |
| 111 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
| 112 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutMaxBackoff, interval); |
| 113 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutMaxBackoff, fuzz); |
| 114 | |
| 115 | scheduler_.set_poll_interval(UpdateCheckScheduler::kTimeoutPeriodic - 1); |
| 116 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
| 117 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutPeriodic, interval); |
| 118 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutRegularFuzz, fuzz); |
| 119 | } |
| 120 | |
| 121 | TEST_F(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzPriorityTest) { |
| 122 | int interval, fuzz; |
| 123 | attempter_.set_http_response_code(500); |
| 124 | scheduler_.last_interval_ = UpdateCheckScheduler::kTimeoutPeriodic + 50; |
| 125 | int poll_interval = UpdateCheckScheduler::kTimeoutPeriodic + 100; |
| 126 | scheduler_.set_poll_interval(poll_interval); |
| 127 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
| 128 | EXPECT_EQ(poll_interval, interval); |
| 129 | EXPECT_EQ(poll_interval, fuzz); |
| 130 | } |
| 131 | |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 132 | TEST_F(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzTest) { |
| 133 | int interval, fuzz; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 134 | scheduler_.ComputeNextIntervalAndFuzz(&interval, &fuzz); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 135 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutPeriodic, interval); |
| 136 | EXPECT_EQ(UpdateCheckScheduler::kTimeoutRegularFuzz, fuzz); |
| 137 | } |
| 138 | |
| 139 | TEST_F(UpdateCheckSchedulerTest, GTimeoutAddSecondsTest) { |
| 140 | loop_ = g_main_loop_new(g_main_context_default(), FALSE); |
| 141 | // Invokes the actual GLib wrapper method rather than the subclass mock. |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 142 | scheduler_.UpdateCheckScheduler::GTimeoutAddSeconds(0, SourceCallback); |
| 143 | EXPECT_CALL(source_callback_, Call(&scheduler_)).Times(1); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 144 | g_main_loop_run(loop_); |
| 145 | g_main_loop_unref(loop_); |
| 146 | } |
| 147 | |
| 148 | TEST_F(UpdateCheckSchedulerTest, IsBootDeviceRemovableTest) { |
| 149 | // Invokes the actual utils wrapper method rather than the subclass mock. |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 150 | EXPECT_FALSE(scheduler_.UpdateCheckScheduler::IsBootDeviceRemovable()); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 151 | } |
| 152 | |
Darin Petkov | 2a0e633 | 2010-09-24 14:43:41 -0700 | [diff] [blame] | 153 | TEST_F(UpdateCheckSchedulerTest, IsOOBECompleteTest) { |
| 154 | // Invokes the actual utils wrapper method rather than the subclass mock. |
| 155 | EXPECT_FALSE(scheduler_.UpdateCheckScheduler::IsOOBEComplete()); |
| 156 | } |
| 157 | |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 158 | TEST_F(UpdateCheckSchedulerTest, IsOfficialBuildTest) { |
| 159 | // Invokes the actual utils wrapper method rather than the subclass mock. |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 160 | EXPECT_TRUE(scheduler_.UpdateCheckScheduler::IsOfficialBuild()); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | TEST_F(UpdateCheckSchedulerTest, RunBootDeviceRemovableTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 164 | scheduler_.enabled_ = true; |
| 165 | EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(true)); |
| 166 | EXPECT_CALL(scheduler_, IsBootDeviceRemovable()) |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 167 | .Times(1) |
| 168 | .WillOnce(Return(true)); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 169 | scheduler_.Run(); |
| 170 | EXPECT_FALSE(scheduler_.enabled_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 171 | EXPECT_EQ(NULL, attempter_.update_check_scheduler()); |
| 172 | } |
| 173 | |
| 174 | TEST_F(UpdateCheckSchedulerTest, RunNonOfficialBuildTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 175 | scheduler_.enabled_ = true; |
| 176 | EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(false)); |
| 177 | scheduler_.Run(); |
| 178 | EXPECT_FALSE(scheduler_.enabled_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 179 | EXPECT_EQ(NULL, attempter_.update_check_scheduler()); |
| 180 | } |
| 181 | |
| 182 | TEST_F(UpdateCheckSchedulerTest, RunTest) { |
| 183 | int interval_min, interval_max; |
| 184 | FuzzRange(UpdateCheckScheduler::kTimeoutOnce, |
| 185 | UpdateCheckScheduler::kTimeoutRegularFuzz, |
| 186 | &interval_min, |
| 187 | &interval_max); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 188 | EXPECT_CALL(scheduler_, IsOfficialBuild()).Times(1).WillOnce(Return(true)); |
| 189 | EXPECT_CALL(scheduler_, IsBootDeviceRemovable()) |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 190 | .Times(1) |
| 191 | .WillOnce(Return(false)); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 192 | EXPECT_CALL(scheduler_, |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 193 | GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 194 | scheduler_.StaticCheck)).Times(1); |
| 195 | scheduler_.Run(); |
| 196 | EXPECT_TRUE(scheduler_.enabled_); |
| 197 | EXPECT_EQ(&scheduler_, attempter_.update_check_scheduler()); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | TEST_F(UpdateCheckSchedulerTest, ScheduleCheckDisabledTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 201 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
| 202 | scheduler_.ScheduleCheck(250, 30); |
| 203 | EXPECT_EQ(0, scheduler_.last_interval_); |
| 204 | EXPECT_FALSE(scheduler_.scheduled_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | TEST_F(UpdateCheckSchedulerTest, ScheduleCheckEnabledTest) { |
| 208 | int interval_min, interval_max; |
| 209 | FuzzRange(100, 10, &interval_min,&interval_max); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 210 | EXPECT_CALL(scheduler_, |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 211 | GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 212 | scheduler_.StaticCheck)).Times(1); |
| 213 | scheduler_.enabled_ = true; |
| 214 | scheduler_.ScheduleCheck(100, 10); |
| 215 | EXPECT_EQ(100, scheduler_.last_interval_); |
| 216 | EXPECT_TRUE(scheduler_.scheduled_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | TEST_F(UpdateCheckSchedulerTest, ScheduleCheckNegativeIntervalTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 220 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(0, scheduler_.StaticCheck)) |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 221 | .Times(1); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 222 | scheduler_.enabled_ = true; |
| 223 | scheduler_.ScheduleCheck(-50, 20); |
| 224 | EXPECT_TRUE(scheduler_.scheduled_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | TEST_F(UpdateCheckSchedulerTest, ScheduleNextCheckDisabledTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 228 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
| 229 | scheduler_.ScheduleNextCheck(); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | TEST_F(UpdateCheckSchedulerTest, ScheduleNextCheckEnabledTest) { |
| 233 | int interval_min, interval_max; |
| 234 | FuzzRange(UpdateCheckScheduler::kTimeoutPeriodic, |
| 235 | UpdateCheckScheduler::kTimeoutRegularFuzz, |
| 236 | &interval_min, |
| 237 | &interval_max); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 238 | EXPECT_CALL(scheduler_, |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 239 | GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 240 | scheduler_.StaticCheck)).Times(1); |
| 241 | scheduler_.enabled_ = true; |
| 242 | scheduler_.ScheduleNextCheck(); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | TEST_F(UpdateCheckSchedulerTest, SetUpdateStatusIdleDisabledTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 246 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
| 247 | scheduler_.SetUpdateStatus(UPDATE_STATUS_IDLE); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | TEST_F(UpdateCheckSchedulerTest, SetUpdateStatusIdleEnabledTest) { |
| 251 | int interval_min, interval_max; |
| 252 | FuzzRange(UpdateCheckScheduler::kTimeoutPeriodic, |
| 253 | UpdateCheckScheduler::kTimeoutRegularFuzz, |
| 254 | &interval_min, |
| 255 | &interval_max); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 256 | EXPECT_CALL(scheduler_, |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 257 | GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 258 | scheduler_.StaticCheck)).Times(1); |
| 259 | scheduler_.enabled_ = true; |
| 260 | scheduler_.SetUpdateStatus(UPDATE_STATUS_IDLE); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | TEST_F(UpdateCheckSchedulerTest, SetUpdateStatusNonIdleTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 264 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
| 265 | scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); |
| 266 | scheduler_.enabled_ = true; |
| 267 | scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 268 | } |
| 269 | |
Darin Petkov | 2a0e633 | 2010-09-24 14:43:41 -0700 | [diff] [blame] | 270 | TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBECompleteTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 271 | scheduler_.scheduled_ = true; |
Darin Petkov | 2a0e633 | 2010-09-24 14:43:41 -0700 | [diff] [blame] | 272 | EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(true)); |
| 273 | EXPECT_CALL(attempter_, Update("", "")) |
| 274 | .Times(1) |
| 275 | .WillOnce(Assign(&scheduler_.scheduled_, true)); |
| 276 | scheduler_.enabled_ = true; |
| 277 | EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
| 278 | UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); |
| 279 | } |
| 280 | |
| 281 | TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBENotCompleteTest) { |
| 282 | scheduler_.scheduled_ = true; |
| 283 | EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(false)); |
| 284 | EXPECT_CALL(attempter_, Update("", "")).Times(0); |
| 285 | int interval_min, interval_max; |
| 286 | FuzzRange(UpdateCheckScheduler::kTimeoutOnce, |
| 287 | UpdateCheckScheduler::kTimeoutRegularFuzz, |
| 288 | &interval_min, |
| 289 | &interval_max); |
| 290 | scheduler_.enabled_ = true; |
| 291 | EXPECT_CALL(scheduler_, |
| 292 | GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
| 293 | scheduler_.StaticCheck)).Times(1); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 294 | UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); |
Darin Petkov | 1023a60 | 2010-08-30 13:47:51 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | } // namespace chromeos_update_engine |