Index: chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc |
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc |
index 4f00912050303c7250eacb231c04ef53c71f5c73..64394388242f2379e6f1124dbd53c12bfda57373 100644 |
--- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc |
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc |
@@ -22,6 +22,7 @@ |
#include "base/single_thread_task_runner.h" |
bartfab (slow)
2015/01/08 14:14:36
Nit: No longer used.
engedy
2015/01/08 16:41:27
Done.
|
#include "base/strings/string_number_conversions.h" |
#include "base/test/simple_test_tick_clock.h" |
+#include "base/test/test_mock_time_task_runner.h" |
#include "base/thread_task_runner_handle.h" |
#include "base/threading/sequenced_worker_pool.h" |
#include "base/time/tick_clock.h" |
@@ -55,68 +56,54 @@ namespace system { |
namespace { |
-// A SingleThreadTaskRunner that mocks the current time and allows it to be |
-// fast-forwarded. The current time in ticks is returned by Now(). The |
-// corresponding device uptime is written to |uptime_file_|, providing a mock |
bartfab (slow)
2015/01/08 14:14:36
Nit: Use the second part of the class comment to d
engedy
2015/01/08 16:41:26
Done. I have formulated something along that line.
|
-// for /proc/uptime. |
-class MockTimeSingleThreadTaskRunner : public base::SingleThreadTaskRunner { |
+class MockUptimeProvider { |
public: |
- MockTimeSingleThreadTaskRunner(); |
+ explicit MockUptimeProvider(scoped_ptr<base::TickClock> tick_clock); |
- // base::SingleThreadTaskRunner: |
- virtual bool RunsTasksOnCurrentThread() const override; |
- virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
- const base::Closure& task, |
- base::TimeDelta delay) override; |
- virtual bool PostNonNestableDelayedTask( |
- const tracked_objects::Location& from_here, |
- const base::Closure& task, |
- base::TimeDelta delay) override; |
+ void WriteUptimeToFile(); |
- void SetUptimeFile(const base::FilePath& uptime_file); |
- void SetUptime(const base::TimeDelta& uptime); |
+ void set_uptime_file_path(const base::FilePath& uptime_file_path) { |
+ uptime_file_path_ = uptime_file_path; |
+ } |
- const base::TimeDelta& Uptime() const; |
- const base::TimeTicks& Now() const; |
+ void set_uptime(const base::TimeDelta& uptime) { |
bartfab (slow)
2015/01/08 14:14:36
Nit: This should not be a hacker_style() inline me
engedy
2015/01/08 16:41:27
Done.
|
+ uptime_offset_ = uptime - (tick_clock_->NowTicks() - base::TimeTicks()); |
+ WriteUptimeToFile(); |
+ } |
- void FastForwardBy(const base::TimeDelta& delta); |
- void FastForwardUntilNoTasksRemain(); |
- void RunUntilIdle(); |
+ base::TimeDelta uptime() const { |
+ return tick_clock_->NowTicks() - base::TimeTicks() + uptime_offset_; |
+ } |
private: |
- // Strict weak temporal ordering of tasks. |
- class TemporalOrder { |
- public: |
- bool operator()( |
- const std::pair<base::TimeTicks, base::Closure>& first_task, |
- const std::pair<base::TimeTicks, base::Closure>& second_task) const; |
- }; |
- |
- virtual ~MockTimeSingleThreadTaskRunner(); |
- |
- base::FilePath uptime_file_; |
- base::TimeDelta uptime_; |
- base::TimeTicks now_; |
- std::priority_queue<std::pair<base::TimeTicks, base::Closure>, |
- std::vector<std::pair<base::TimeTicks, base::Closure> >, |
- TemporalOrder> tasks_; |
- |
- DISALLOW_COPY_AND_ASSIGN(MockTimeSingleThreadTaskRunner); |
+ scoped_ptr<base::TickClock> tick_clock_; |
+ |
+ base::FilePath uptime_file_path_; |
+ base::TimeDelta uptime_offset_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MockUptimeProvider); |
}; |
-class MockTimeTickClock : public base::TickClock { |
+class TestAutomaticRebootManagerTaskRunner |
+ : public base::TestMockTimeTaskRunner { |
public: |
- explicit MockTimeTickClock( |
- scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner); |
- virtual ~MockTimeTickClock(); |
+ TestAutomaticRebootManagerTaskRunner(); |
- // base::TickClock: |
- virtual base::TimeTicks NowTicks() override; |
+ MockUptimeProvider* uptime_provider() const { |
+ return uptime_provider_.get(); |
+ } |
private: |
- scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner_; |
+ ~TestAutomaticRebootManagerTaskRunner(); |
+ |
+ // base::TestMockTimeTaskRunner: |
+ void OnBeforeSelectingTask() override; |
+ void OnAfterTimePasses() override; |
+ void OnAfterRunningTask() override; |
- DISALLOW_COPY_AND_ASSIGN(MockTimeTickClock); |
+ scoped_ptr<MockUptimeProvider> uptime_provider_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestAutomaticRebootManagerTaskRunner); |
}; |
class MockAutomaticRebootManagerObserver |
@@ -141,7 +128,8 @@ class MockAutomaticRebootManagerObserver |
} // namespace |
-class AutomaticRebootManagerBasicTest : public testing::Test { |
+class AutomaticRebootManagerBasicTest |
+ : public testing::Test { |
bartfab (slow)
2015/01/08 14:14:36
Nit: Why does this suddenly no longer fit on one l
engedy
2015/01/08 16:41:26
I guess I might have added another base class for
|
protected: |
typedef base::OneShotTimer<AutomaticRebootManager> Timer; |
@@ -189,7 +177,8 @@ class AutomaticRebootManagerBasicTest : public testing::Test { |
base::TimeDelta update_reboot_needed_uptime_; |
base::TimeDelta uptime_limit_; |
- scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner_; |
+ scoped_refptr<TestAutomaticRebootManagerTaskRunner> task_runner_; |
+ MockUptimeProvider* uptime_provider_; // Weak, owner by |task_runner_|. |
bartfab (slow)
2015/01/08 14:14:36
Nit 1: s/owner/owned/
Nit 2: The comment is not re
engedy
2015/01/08 16:41:27
I removed weak, but kept the rest so it is clearer
|
MockAutomaticRebootManagerObserver automatic_reboot_manager_observer_; |
scoped_ptr<AutomaticRebootManager> automatic_reboot_manager_; |
@@ -244,114 +233,35 @@ void SaveUptimeToFile(const base::FilePath& path, |
uptime_seconds.size())); |
} |
-MockTimeSingleThreadTaskRunner::MockTimeSingleThreadTaskRunner() { |
-} |
- |
-bool MockTimeSingleThreadTaskRunner::RunsTasksOnCurrentThread() const { |
- return true; |
-} |
- |
-bool MockTimeSingleThreadTaskRunner::PostDelayedTask( |
- const tracked_objects::Location& from_here, |
- const base::Closure& task, |
- base::TimeDelta delay) { |
- tasks_.push(std::pair<base::TimeTicks, base::Closure>(now_ + delay, task)); |
- return true; |
-} |
- |
-bool MockTimeSingleThreadTaskRunner::PostNonNestableDelayedTask( |
- const tracked_objects::Location& from_here, |
- const base::Closure& task, |
- base::TimeDelta delay) { |
- NOTREACHED(); |
- return false; |
-} |
- |
-void MockTimeSingleThreadTaskRunner::SetUptimeFile( |
- const base::FilePath& uptime_file) { |
- uptime_file_ = uptime_file; |
- SaveUptimeToFile(uptime_file_, uptime_); |
+MockUptimeProvider::MockUptimeProvider(scoped_ptr<base::TickClock> tick_clock) |
+ : tick_clock_(tick_clock.Pass()) { |
} |
-void MockTimeSingleThreadTaskRunner::SetUptime(const base::TimeDelta& uptime) { |
- uptime_ = uptime; |
- SaveUptimeToFile(uptime_file_, uptime_); |
+void MockUptimeProvider::WriteUptimeToFile() { |
+ SaveUptimeToFile(uptime_file_path_, uptime()); |
} |
-const base::TimeDelta& MockTimeSingleThreadTaskRunner::Uptime() const { |
- return uptime_; |
+TestAutomaticRebootManagerTaskRunner::TestAutomaticRebootManagerTaskRunner() |
+ : uptime_provider_(new MockUptimeProvider(GetMockTickClock())) { |
} |
-const base::TimeTicks& MockTimeSingleThreadTaskRunner::Now() const { |
- return now_; |
+TestAutomaticRebootManagerTaskRunner::~TestAutomaticRebootManagerTaskRunner() { |
} |
-void MockTimeSingleThreadTaskRunner::FastForwardBy( |
- const base::TimeDelta& delta) { |
- const base::TimeTicks latest = now_ + delta; |
+void TestAutomaticRebootManagerTaskRunner::OnBeforeSelectingTask() { |
base::SequencedWorkerPool* blocking_pool = |
content::BrowserThread::GetBlockingPool(); |
blocking_pool->FlushForTesting(); |
- while (!tasks_.empty() && tasks_.top().first <= latest) { |
- uptime_ += tasks_.top().first - now_; |
- SaveUptimeToFile(uptime_file_, uptime_); |
- now_ = tasks_.top().first; |
- base::Closure task = tasks_.top().second; |
- tasks_.pop(); |
- task.Run(); |
- blocking_pool->FlushForTesting(); |
- } |
- uptime_ += latest - now_; |
- SaveUptimeToFile(uptime_file_, uptime_); |
- now_ = latest; |
} |
-void MockTimeSingleThreadTaskRunner::FastForwardUntilNoTasksRemain() { |
- base::SequencedWorkerPool* blocking_pool = |
- content::BrowserThread::GetBlockingPool(); |
- blocking_pool->FlushForTesting(); |
- while (!tasks_.empty()) { |
- uptime_ += tasks_.top().first - now_; |
- SaveUptimeToFile(uptime_file_, uptime_); |
- now_ = tasks_.top().first; |
- base::Closure task = tasks_.top().second; |
- tasks_.pop(); |
- task.Run(); |
- blocking_pool->FlushForTesting(); |
- } |
+void TestAutomaticRebootManagerTaskRunner::OnAfterTimePasses() { |
+ uptime_provider_->WriteUptimeToFile(); |
} |
-void MockTimeSingleThreadTaskRunner::RunUntilIdle() { |
+void TestAutomaticRebootManagerTaskRunner::OnAfterRunningTask() { |
base::SequencedWorkerPool* blocking_pool = |
content::BrowserThread::GetBlockingPool(); |
blocking_pool->FlushForTesting(); |
- while (!tasks_.empty() && tasks_.top().first <= now_) { |
- base::Closure task = tasks_.top().second; |
- tasks_.pop(); |
- task.Run(); |
- blocking_pool->FlushForTesting(); |
- } |
-} |
- |
-bool MockTimeSingleThreadTaskRunner::TemporalOrder::operator()( |
- const std::pair<base::TimeTicks, base::Closure>& first_task, |
- const std::pair<base::TimeTicks, base::Closure>& second_task) const { |
- return first_task.first > second_task.first; |
-} |
- |
-MockTimeSingleThreadTaskRunner::~MockTimeSingleThreadTaskRunner() { |
-} |
- |
-MockTimeTickClock::MockTimeTickClock( |
- scoped_refptr<MockTimeSingleThreadTaskRunner> task_runner) |
- : task_runner_(task_runner) { |
-} |
- |
-MockTimeTickClock::~MockTimeTickClock() { |
-} |
- |
-base::TimeTicks MockTimeTickClock::NowTicks() { |
- return task_runner_->Now(); |
} |
MockAutomaticRebootManagerObserver::MockAutomaticRebootManagerObserver() |
@@ -383,13 +293,14 @@ void MockAutomaticRebootManagerObserver::StopObserving() { |
AutomaticRebootManagerBasicTest::AutomaticRebootManagerBasicTest() |
: is_user_logged_in_(false), |
is_logged_in_as_kiosk_app_(false), |
- task_runner_(new MockTimeSingleThreadTaskRunner), |
+ task_runner_(new TestAutomaticRebootManagerTaskRunner), |
reboot_after_update_(false), |
ui_thread_task_runner_handle_(task_runner_), |
mock_user_manager_(new MockUserManager), |
user_manager_enabler_(mock_user_manager_), |
power_manager_client_(NULL), |
update_engine_client_(NULL) { |
+ uptime_provider_ = task_runner_->uptime_provider(); |
} |
AutomaticRebootManagerBasicTest::~AutomaticRebootManagerBasicTest() { |
@@ -399,7 +310,7 @@ void AutomaticRebootManagerBasicTest::SetUp() { |
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
const base::FilePath& temp_dir = temp_dir_.path(); |
const base::FilePath uptime_file = temp_dir.Append("uptime"); |
- task_runner_->SetUptimeFile(uptime_file); |
+ uptime_provider_->set_uptime_file_path(uptime_file); |
ASSERT_FALSE(base::WriteFile(uptime_file, NULL, 0)); |
update_reboot_needed_uptime_file_ = |
temp_dir.Append("update_reboot_needed_uptime"); |
@@ -538,7 +449,7 @@ void AutomaticRebootManagerBasicTest::ExpectNoRebootRequest() { |
void AutomaticRebootManagerBasicTest::CreateAutomaticRebootManager( |
bool expect_reboot) { |
automatic_reboot_manager_.reset(new AutomaticRebootManager( |
- scoped_ptr<base::TickClock>(new MockTimeTickClock(task_runner_)))); |
+ scoped_ptr<base::TickClock>(task_runner_->GetMockTickClock()))); |
automatic_reboot_manager_observer_.Init(automatic_reboot_manager_.get()); |
task_runner_->RunUntilIdle(); |
EXPECT_EQ(expect_reboot ? 1 : 0, |
@@ -546,7 +457,7 @@ void AutomaticRebootManagerBasicTest::CreateAutomaticRebootManager( |
uptime_processing_delay_ = |
base::TimeTicks() - automatic_reboot_manager_->boot_time_ - |
- task_runner_->Uptime(); |
+ uptime_provider_->uptime(); |
EXPECT_GE(uptime_processing_delay_, base::TimeDelta()); |
EXPECT_LE(uptime_processing_delay_, base::TimeDelta::FromSeconds(1)); |
@@ -596,7 +507,7 @@ void AutomaticRebootManagerBasicTest::VerifyNoGracePeriod() const { |
void AutomaticRebootManagerBasicTest::VerifyGracePeriod( |
const base::TimeDelta& start_uptime) const { |
const base::TimeDelta start = |
- start_uptime - task_runner_->Uptime() - uptime_processing_delay_; |
+ start_uptime - uptime_provider_->uptime() - uptime_processing_delay_; |
const base::TimeDelta end = start + base::TimeDelta::FromHours(24); |
if (start <= base::TimeDelta()) { |
EXPECT_TRUE(automatic_reboot_manager_->reboot_requested_); |
@@ -664,7 +575,7 @@ AutomaticRebootManagerTest::~AutomaticRebootManagerTest() { |
// Verifies that the idle timer is running. Further verifies that when a kiosk |
// app session begins, the idle timer is stopped. |
TEST_F(AutomaticRebootManagerBasicTest, LoginStopsIdleTimer) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested, the device does not reboot immediately |
// and the login screen idle timer is started. |
@@ -691,7 +602,7 @@ TEST_F(AutomaticRebootManagerBasicTest, LoginStopsIdleTimer) { |
// Verifies that the idle timer is running. Further verifies that when a |
// non-kiosk-app session begins, the idle timer is stopped. |
TEST_F(AutomaticRebootManagerBasicTest, NonKioskLoginStopsIdleTimer) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested, the device does not reboot immediately |
// and the login screen idle timer is started. |
@@ -718,7 +629,7 @@ TEST_F(AutomaticRebootManagerBasicTest, NonKioskLoginStopsIdleTimer) { |
// Verifies that user activity prevents the device from rebooting. Further |
// verifies that when user activity ceases, the devices reboots. |
TEST_F(AutomaticRebootManagerBasicTest, UserActivityResetsIdleTimer) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested, the device does not reboot immediately |
// and the login screen idle timer is started. |
@@ -756,7 +667,7 @@ TEST_F(AutomaticRebootManagerBasicTest, UserActivityResetsIdleTimer) { |
TEST_F(AutomaticRebootManagerBasicTest, ResumeNoPolicy) { |
is_user_logged_in_ = true; |
is_logged_in_as_kiosk_app_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -780,7 +691,7 @@ TEST_F(AutomaticRebootManagerBasicTest, ResumeNoPolicy) { |
// immediately reboot. |
TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeAppNoPolicy) { |
is_user_logged_in_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -806,7 +717,7 @@ TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeAppNoPolicy) { |
TEST_F(AutomaticRebootManagerBasicTest, ResumeBeforeGracePeriod) { |
is_user_logged_in_ = true; |
is_logged_in_as_kiosk_app_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -836,7 +747,7 @@ TEST_F(AutomaticRebootManagerBasicTest, ResumeBeforeGracePeriod) { |
// immediately reboot. |
TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeBeforeGracePeriod) { |
is_user_logged_in_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -867,7 +778,7 @@ TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeBeforeGracePeriod) { |
TEST_F(AutomaticRebootManagerBasicTest, ResumeInGracePeriod) { |
is_user_logged_in_ = true; |
is_logged_in_as_kiosk_app_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -894,7 +805,7 @@ TEST_F(AutomaticRebootManagerBasicTest, ResumeInGracePeriod) { |
// immediately reboot. |
TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeInGracePeriod) { |
is_user_logged_in_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -925,7 +836,7 @@ TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeInGracePeriod) { |
TEST_F(AutomaticRebootManagerBasicTest, ResumeAfterGracePeriod) { |
is_user_logged_in_ = true; |
is_logged_in_as_kiosk_app_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(29) + |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(29) + |
base::TimeDelta::FromMinutes(30)); |
// Verify that no reboot is requested and the device does not reboot |
@@ -953,7 +864,7 @@ TEST_F(AutomaticRebootManagerBasicTest, ResumeAfterGracePeriod) { |
// immediately reboot. |
TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeAfterGracePeriod) { |
is_user_logged_in_ = true; |
- task_runner_->SetUptime(base::TimeDelta::FromHours(29) + |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(29) + |
base::TimeDelta::FromMinutes(30)); |
// Verify that no reboot is requested and the device does not reboot |
@@ -982,7 +893,7 @@ TEST_F(AutomaticRebootManagerBasicTest, NonKioskResumeAfterGracePeriod) { |
// Verifies that when the browser terminates, the device does not immediately |
// reboot. |
TEST_P(AutomaticRebootManagerTest, TerminateNoPolicy) { |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1005,7 +916,7 @@ TEST_P(AutomaticRebootManagerTest, TerminateNoPolicy) { |
// 12 hours. |
// Verifies that when the browser terminates, it does not immediately reboot. |
TEST_P(AutomaticRebootManagerTest, TerminateBeforeGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1036,7 +947,7 @@ TEST_P(AutomaticRebootManagerTest, TerminateBeforeGracePeriod) { |
// Verifies that when the browser terminates, the device immediately reboots if |
// a kiosk app session is in progress. |
TEST_P(AutomaticRebootManagerTest, TerminateInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1066,7 +977,7 @@ TEST_P(AutomaticRebootManagerTest, TerminateInGracePeriod) { |
// Verifies that when the uptime limit is set to 24 hours, no reboot occurs and |
// a grace period is scheduled to begin after 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, BeforeUptimeLimitGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1095,7 +1006,7 @@ TEST_P(AutomaticRebootManagerTest, BeforeUptimeLimitGracePeriod) { |
// Verifies that when the uptime limit is set to 6 hours, a reboot is requested |
// and a grace period is started that will end after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, InUptimeLimitGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1125,7 +1036,7 @@ TEST_P(AutomaticRebootManagerTest, InUptimeLimitGracePeriod) { |
// immediately if no non-kiosk-app-session is in progress because the grace |
// period ended after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, AfterUptimeLimitGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1152,7 +1063,7 @@ TEST_P(AutomaticRebootManagerTest, AfterUptimeLimitGracePeriod) { |
// 6 hours. |
// Verifies that when the uptime limit is removed, the grace period is removed. |
TEST_P(AutomaticRebootManagerTest, UptimeLimitOffBeforeGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(6)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(6)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1186,7 +1097,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitOffBeforeGracePeriod) { |
// 24 hours. |
// Verifies that when the uptime limit is removed, the grace period is removed. |
TEST_P(AutomaticRebootManagerTest, UptimeLimitOffInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(24)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(24)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1222,7 +1133,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitOffInGracePeriod) { |
// Verifies that when the uptime limit is extended to 24 hours, the grace period |
// is rescheduled to start further in the future. |
TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitBeforeGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(6)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(6)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1261,7 +1172,7 @@ TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitBeforeGracePeriod) { |
// Verifies that when the uptime limit is extended to 24 hours, the grace period |
// is rescheduled to start in the future. |
TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(18)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(18)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1300,7 +1211,7 @@ TEST_P(AutomaticRebootManagerTest, ExtendUptimeLimitInGracePeriod) { |
// Verifies that when the uptime limit is shortened to 6 hours, the grace period |
// is rescheduled to have already started. |
TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitBeforeToInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1338,7 +1249,7 @@ TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitBeforeToInGracePeriod) { |
// Verifies that when the uptime limit is shortened to 18 hours, the grace |
// period is rescheduled to have started earlier. |
TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(36)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(36)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1378,7 +1289,7 @@ TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToInGracePeriod) { |
// reboots immediately if no non-kiosk-app session is in progress because the |
// grace period ended after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToAfterGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(36)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(36)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1417,7 +1328,7 @@ TEST_P(AutomaticRebootManagerTest, ShortenUptimeLimitInToAfterGracePeriod) { |
// policy to automatically reboot after an update is not enabled, no reboot |
// occurs and no grace period is scheduled. |
TEST_P(AutomaticRebootManagerTest, UpdateNoPolicy) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1436,7 +1347,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateNoPolicy) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that no grace period has started. |
VerifyNoGracePeriod(); |
@@ -1451,7 +1362,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateNoPolicy) { |
// policy to automatically reboot after an update is enabled, a reboot is |
// requested and a grace period is started that will end 24 hours from now. |
TEST_P(AutomaticRebootManagerTest, Update) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1472,7 +1383,7 @@ TEST_P(AutomaticRebootManagerTest, Update) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that a grace period has started. |
VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_); |
@@ -1488,7 +1399,7 @@ TEST_P(AutomaticRebootManagerTest, Update) { |
// the second notification is ignored and the uptime at which it occurred does |
// not get persisted as the time at which an update became necessary. |
TEST_P(AutomaticRebootManagerTest, UpdateAfterUpdate) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1509,7 +1420,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateAfterUpdate) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that a grace period has started. |
VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_); |
@@ -1542,7 +1453,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateAfterUpdate) { |
// the current uptime is persisted as the time at which a reboot became |
// necessary. |
TEST_P(AutomaticRebootManagerTest, UpdateBeforeMinimumUptime) { |
- task_runner_->SetUptime(base::TimeDelta::FromMinutes(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromMinutes(10)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1562,7 +1473,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateBeforeMinimumUptime) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that a grace period has been scheduled to begin in the future. |
VerifyGracePeriod(base::TimeDelta::FromHours(1)); |
@@ -1581,7 +1492,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateBeforeMinimumUptime) { |
// enabled, a reboot is requested and a grace period is started that will end |
// after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateInGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(6)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(6)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1621,7 +1532,7 @@ TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateInGracePeriod) { |
// enabled, the device reboots immediately if no non-kiosk-app session is in |
// progress because the grace period ended after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateAfterGracePeriod) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(6)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(6)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -1660,7 +1571,7 @@ TEST_P(AutomaticRebootManagerTest, PolicyAfterUpdateAfterGracePeriod) { |
// Verifies that when the policy to automatically reboot after an update is |
// disabled, the reboot request and grace period are removed. |
TEST_P(AutomaticRebootManagerTest, PolicyOffAfterUpdate) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(6)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(6)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1675,7 +1586,7 @@ TEST_P(AutomaticRebootManagerTest, PolicyOffAfterUpdate) { |
NotifyUpdateRebootNeeded(); |
// Verify that a grace period has started. |
- VerifyGracePeriod(task_runner_->Uptime() + uptime_processing_delay_); |
+ VerifyGracePeriod(uptime_provider_->uptime() + uptime_processing_delay_); |
// Fast forward the uptime by 20 seconds. Verify that the device does not |
// reboot immediately. |
@@ -1741,7 +1652,7 @@ TEST_P(AutomaticRebootManagerTest, NoUptime) { |
// that the current uptime is persisted as the time at which a reboot became |
// necessary. |
TEST_P(AutomaticRebootManagerTest, UptimeLimitBeforeUpdate) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1772,7 +1683,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitBeforeUpdate) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that the grace period has not been rescheduled. |
VerifyGracePeriod(uptime_limit_); |
@@ -1790,7 +1701,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitBeforeUpdate) { |
// from now. Further verifies that the current uptime is persisted as the time |
// at which a reboot became necessary. |
TEST_P(AutomaticRebootManagerTest, UpdateBeforeUptimeLimit) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1819,7 +1730,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateBeforeUptimeLimit) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that the grace period has been rescheduled to start at the time that |
// the update became available. |
@@ -1839,7 +1750,7 @@ TEST_P(AutomaticRebootManagerTest, UpdateBeforeUptimeLimit) { |
// grace period is rescheduled to start after 12 hours of uptime. Further |
// verifies that when the uptime limit is removed, the grace period is removed. |
TEST_P(AutomaticRebootManagerTest, PolicyOffThenUptimeLimitOff) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1864,7 +1775,7 @@ TEST_P(AutomaticRebootManagerTest, PolicyOffThenUptimeLimitOff) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that a grace period has been rescheduled to end 24 hours from now. |
VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_); |
@@ -1901,7 +1812,7 @@ TEST_P(AutomaticRebootManagerTest, PolicyOffThenUptimeLimitOff) { |
// when the policy to reboot after an update is disabled, the reboot request and |
// grace period are removed. |
TEST_P(AutomaticRebootManagerTest, UptimeLimitOffThenPolicyOff) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -1919,7 +1830,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitOffThenPolicyOff) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that the grace period has started. |
VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_); |
@@ -1962,7 +1873,7 @@ TEST_P(AutomaticRebootManagerTest, UptimeLimitOffThenPolicyOff) { |
// Verifies that if no non-kiosk-app session is in progress, the device reboots |
// immediately when the grace period ends after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, GracePeriodEnd) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(29) + |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(29) + |
base::TimeDelta::FromMinutes(59) + |
base::TimeDelta::FromSeconds(59)); |
@@ -1995,7 +1906,7 @@ TEST_P(AutomaticRebootManagerTest, GracePeriodEnd) { |
// Verifies that when no automatic reboot policy is enabled, no reboot occurs |
// and no grace period is scheduled. |
TEST_P(AutomaticRebootManagerTest, StartNoPolicy) { |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -2016,7 +1927,7 @@ TEST_P(AutomaticRebootManagerTest, StartNoPolicy) { |
// 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, StartBeforeUptimeLimitGracePeriod) { |
SetUptimeLimit(base::TimeDelta::FromHours(24), false); |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -2040,7 +1951,7 @@ TEST_P(AutomaticRebootManagerTest, StartBeforeUptimeLimitGracePeriod) { |
// immediately because the grace period ended after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, StartAfterUptimeLimitGracePeriod) { |
SetUptimeLimit(base::TimeDelta::FromHours(6), false); |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that a reboot is requested and unless a non-kiosk-app session is in |
// progress, the the device immediately reboots. |
@@ -2061,7 +1972,7 @@ TEST_P(AutomaticRebootManagerTest, StartAfterUptimeLimitGracePeriod) { |
// end after 6 + 24 hours of uptime. |
TEST_P(AutomaticRebootManagerTest, StartInUptimeLimitGracePeriod) { |
SetUptimeLimit(base::TimeDelta::FromHours(6), false); |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
// Verify that a reboot is requested but the device does not reboot |
// immediately. |
@@ -2087,7 +1998,7 @@ TEST_P(AutomaticRebootManagerTest, StartInUptimeLimitGracePeriod) { |
TEST_P(AutomaticRebootManagerTest, StartAfterUpdateGracePeriod) { |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6)); |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
SetRebootAfterUpdate(true, false); |
// Verify that a reboot is requested and unless a non-kiosk-app session is in |
@@ -2113,7 +2024,7 @@ TEST_P(AutomaticRebootManagerTest, StartAfterUpdateGracePeriod) { |
TEST_P(AutomaticRebootManagerTest, StartInUpdateGracePeriod) { |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6)); |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that a reboot is requested but the device does not reboot |
@@ -2141,7 +2052,7 @@ TEST_P(AutomaticRebootManagerTest, StartInUpdateGracePeriod) { |
TEST_P(AutomaticRebootManagerTest, StartBeforeUpdateGracePeriod) { |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromMinutes(10)); |
- task_runner_->SetUptime(base::TimeDelta::FromMinutes(20)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromMinutes(20)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -2168,7 +2079,7 @@ TEST_P(AutomaticRebootManagerTest, StartBeforeUpdateGracePeriod) { |
TEST_P(AutomaticRebootManagerTest, StartUpdateNoPolicy) { |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6)); |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -2192,7 +2103,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateNoPolicy) { |
// is started that will end 24 hours from now. |
TEST_P(AutomaticRebootManagerTest, StartUpdateTimeLost) { |
SetUpdateStatusNeedReboot(); |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
SetRebootAfterUpdate(true, false); |
// Verify that a reboot is requested but the device does not reboot |
@@ -2206,7 +2117,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateTimeLost) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that a grace period has started. |
VerifyGracePeriod(update_reboot_needed_uptime_ + uptime_processing_delay_); |
@@ -2226,7 +2137,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateTimeLost) { |
// is scheduled. |
TEST_P(AutomaticRebootManagerTest, StartUpdateNoPolicyTimeLost) { |
SetUpdateStatusNeedReboot(); |
- task_runner_->SetUptime(base::TimeDelta::FromDays(10)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromDays(10)); |
// Verify that no reboot is requested and the device does not reboot |
// immediately. |
@@ -2238,7 +2149,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateNoPolicyTimeLost) { |
// reboot became necessary. |
EXPECT_TRUE(ReadUpdateRebootNeededUptimeFromFile( |
&update_reboot_needed_uptime_)); |
- EXPECT_EQ(task_runner_->Uptime(), update_reboot_needed_uptime_); |
+ EXPECT_EQ(uptime_provider_->uptime(), update_reboot_needed_uptime_); |
// Verify that no grace period has started. |
VerifyNoGracePeriod(); |
@@ -2253,7 +2164,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateNoPolicyTimeLost) { |
// necessary. Further verifies that no reboot occurs and no grace period is |
// scheduled. |
TEST_P(AutomaticRebootManagerTest, StartNoUpdate) { |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that no reboot is requested and the device does not reboot |
@@ -2284,7 +2195,7 @@ TEST_P(AutomaticRebootManagerTest, StartUptimeLimitBeforeUpdate) { |
SetUptimeLimit(base::TimeDelta::FromHours(6), false); |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(8)); |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that a reboot is requested but the device does not reboot |
@@ -2312,7 +2223,7 @@ TEST_P(AutomaticRebootManagerTest, StartUpdateBeforeUptimeLimit) { |
SetUptimeLimit(base::TimeDelta::FromHours(8), false); |
SetUpdateStatusNeedReboot(); |
SetUpdateRebootNeededUptime(base::TimeDelta::FromHours(6)); |
- task_runner_->SetUptime(base::TimeDelta::FromHours(12)); |
+ uptime_provider_->set_uptime(base::TimeDelta::FromHours(12)); |
SetRebootAfterUpdate(true, false); |
// Verify that a reboot is requested but the device does not reboot |