OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 | 6 |
7 #include "update_engine/update_attempter_mock.h" | 7 #include "update_engine/update_attempter_mock.h" |
8 #include "update_engine/update_check_scheduler.h" | 8 #include "update_engine/update_check_scheduler.h" |
9 | 9 |
10 using std::string; | 10 using std::string; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 TEST_F(UpdateCheckSchedulerTest, SetUpdateStatusNonIdleTest) { | 263 TEST_F(UpdateCheckSchedulerTest, SetUpdateStatusNonIdleTest) { |
264 EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); | 264 EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
265 scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); | 265 scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); |
266 scheduler_.enabled_ = true; | 266 scheduler_.enabled_ = true; |
267 scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); | 267 scheduler_.SetUpdateStatus(UPDATE_STATUS_DOWNLOADING); |
268 } | 268 } |
269 | 269 |
270 TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBECompleteTest) { | 270 TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBECompleteTest) { |
271 scheduler_.scheduled_ = true; | 271 scheduler_.scheduled_ = true; |
272 EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(true)); | 272 EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(true)); |
273 EXPECT_CALL(attempter_, Update("", "")) | 273 EXPECT_CALL(attempter_, Update("", "", false)) |
274 .Times(1) | 274 .Times(1) |
275 .WillOnce(Assign(&scheduler_.scheduled_, true)); | 275 .WillOnce(Assign(&scheduler_.scheduled_, true)); |
276 scheduler_.enabled_ = true; | 276 scheduler_.enabled_ = true; |
277 EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); | 277 EXPECT_CALL(scheduler_, GTimeoutAddSeconds(_, _)).Times(0); |
278 UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); | 278 UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); |
279 } | 279 } |
280 | 280 |
281 TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBENotCompleteTest) { | 281 TEST_F(UpdateCheckSchedulerTest, StaticCheckOOBENotCompleteTest) { |
282 scheduler_.scheduled_ = true; | 282 scheduler_.scheduled_ = true; |
283 EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(false)); | 283 EXPECT_CALL(scheduler_, IsOOBEComplete()).Times(1).WillOnce(Return(false)); |
284 EXPECT_CALL(attempter_, Update("", "")).Times(0); | 284 EXPECT_CALL(attempter_, Update("", "", _)).Times(0); |
285 int interval_min, interval_max; | 285 int interval_min, interval_max; |
286 FuzzRange(UpdateCheckScheduler::kTimeoutOnce, | 286 FuzzRange(UpdateCheckScheduler::kTimeoutOnce, |
287 UpdateCheckScheduler::kTimeoutRegularFuzz, | 287 UpdateCheckScheduler::kTimeoutRegularFuzz, |
288 &interval_min, | 288 &interval_min, |
289 &interval_max); | 289 &interval_max); |
290 scheduler_.enabled_ = true; | 290 scheduler_.enabled_ = true; |
291 EXPECT_CALL(scheduler_, | 291 EXPECT_CALL(scheduler_, |
292 GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), | 292 GTimeoutAddSeconds(AllOf(Ge(interval_min), Le(interval_max)), |
293 scheduler_.StaticCheck)).Times(1); | 293 scheduler_.StaticCheck)).Times(1); |
294 UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); | 294 UpdateCheckSchedulerUnderTest::StaticCheck(&scheduler_); |
295 } | 295 } |
296 | 296 |
297 } // namespace chromeos_update_engine | 297 } // namespace chromeos_update_engine |
OLD | NEW |