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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_SCHEDULER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_SCHEDULER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_SCHEDULER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_SCHEDULER_H__ |
7 | 7 |
8 #include <base/basictypes.h> | 8 #include <base/basictypes.h> |
9 #include <glib.h> | 9 #include <glib.h> |
10 #include <gtest/gtest_prod.h> // for FRIEND_TEST | 10 #include <gtest/gtest_prod.h> // for FRIEND_TEST |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 UpdateCheckScheduler(UpdateAttempter* update_attempter); | 43 UpdateCheckScheduler(UpdateAttempter* update_attempter); |
44 virtual ~UpdateCheckScheduler(); | 44 virtual ~UpdateCheckScheduler(); |
45 | 45 |
46 // Initiates the periodic update checks, if necessary. | 46 // Initiates the periodic update checks, if necessary. |
47 void Run(); | 47 void Run(); |
48 | 48 |
49 // Sets the new update status. This is invoked by UpdateAttempter. | 49 // Sets the new update status. This is invoked by UpdateAttempter. |
50 void SetUpdateStatus(UpdateStatus status); | 50 void SetUpdateStatus(UpdateStatus status); |
51 | 51 |
| 52 void set_poll_interval(int interval) { poll_interval_ = interval; } |
| 53 |
52 private: | 54 private: |
53 friend class UpdateCheckSchedulerTest; | 55 friend class UpdateCheckSchedulerTest; |
54 FRIEND_TEST(UpdateCheckSchedulerTest, CanScheduleTest); | 56 FRIEND_TEST(UpdateCheckSchedulerTest, CanScheduleTest); |
55 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzBackoffTest); | 57 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzBackoffTest); |
| 58 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzPollTest); |
| 59 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzPriorityTest); |
56 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzTest); | 60 FRIEND_TEST(UpdateCheckSchedulerTest, ComputeNextIntervalAndFuzzTest); |
57 FRIEND_TEST(UpdateCheckSchedulerTest, GTimeoutAddSecondsTest); | 61 FRIEND_TEST(UpdateCheckSchedulerTest, GTimeoutAddSecondsTest); |
58 FRIEND_TEST(UpdateCheckSchedulerTest, IsBootDeviceRemovableTest); | 62 FRIEND_TEST(UpdateCheckSchedulerTest, IsBootDeviceRemovableTest); |
59 FRIEND_TEST(UpdateCheckSchedulerTest, IsOfficialBuildTest); | 63 FRIEND_TEST(UpdateCheckSchedulerTest, IsOfficialBuildTest); |
60 FRIEND_TEST(UpdateCheckSchedulerTest, RunBootDeviceRemovableTest); | 64 FRIEND_TEST(UpdateCheckSchedulerTest, RunBootDeviceRemovableTest); |
61 FRIEND_TEST(UpdateCheckSchedulerTest, RunNonOfficialBuildTest); | 65 FRIEND_TEST(UpdateCheckSchedulerTest, RunNonOfficialBuildTest); |
62 FRIEND_TEST(UpdateCheckSchedulerTest, RunTest); | 66 FRIEND_TEST(UpdateCheckSchedulerTest, RunTest); |
63 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckDisabledTest); | 67 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckDisabledTest); |
64 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckEnabledTest); | 68 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckEnabledTest); |
65 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckNegativeIntervalTest); | 69 FRIEND_TEST(UpdateCheckSchedulerTest, ScheduleCheckNegativeIntervalTest); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 107 |
104 // True if automatic update checks should be scheduled, false otherwise. | 108 // True if automatic update checks should be scheduled, false otherwise. |
105 bool enabled_; | 109 bool enabled_; |
106 | 110 |
107 // True if there's an update check scheduled already, false otherwise. | 111 // True if there's an update check scheduled already, false otherwise. |
108 bool scheduled_; | 112 bool scheduled_; |
109 | 113 |
110 // The timeout interval (before fuzzing) for the last update check. | 114 // The timeout interval (before fuzzing) for the last update check. |
111 int last_interval_; | 115 int last_interval_; |
112 | 116 |
| 117 // Server dictated poll interval in seconds, if positive. |
| 118 int poll_interval_; |
| 119 |
113 DISALLOW_COPY_AND_ASSIGN(UpdateCheckScheduler); | 120 DISALLOW_COPY_AND_ASSIGN(UpdateCheckScheduler); |
114 }; | 121 }; |
115 | 122 |
116 } // namespace chromeos_update_engine | 123 } // namespace chromeos_update_engine |
117 | 124 |
118 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CHECK_SCHEDULER_H__ | 125 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CHECK_SCHEDULER_H__ |
OLD | NEW |