Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -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 <base/file_util.h> |
| 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | #include "update_engine/action_mock.h" |
| 9 | #include "update_engine/action_processor_mock.h" |
| 10 | #include "update_engine/filesystem_copier_action.h" |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame] | 11 | #include "update_engine/mock_dbus_interface.h" |
Darin Petkov | 1b00310 | 2010-11-30 10:18:36 -0800 | [diff] [blame] | 12 | #include "update_engine/mock_http_fetcher.h" |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 13 | #include "update_engine/postinstall_runner_action.h" |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 14 | #include "update_engine/prefs_mock.h" |
Darin Petkov | 1b00310 | 2010-11-30 10:18:36 -0800 | [diff] [blame] | 15 | #include "update_engine/test_utils.h" |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 16 | #include "update_engine/update_attempter.h" |
Darin Petkov | 1b00310 | 2010-11-30 10:18:36 -0800 | [diff] [blame] | 17 | #include "update_engine/update_check_scheduler.h" |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 18 | |
| 19 | using std::string; |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 20 | using testing::_; |
| 21 | using testing::DoAll; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 22 | using testing::InSequence; |
Darin Petkov | 2dd0109 | 2010-10-08 15:43:05 -0700 | [diff] [blame] | 23 | using testing::Ne; |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 24 | using testing::NiceMock; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 25 | using testing::Property; |
| 26 | using testing::Return; |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 27 | using testing::SetArgumentPointee; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 28 | |
| 29 | namespace chromeos_update_engine { |
| 30 | |
| 31 | // Test a subclass rather than the main class directly so that we can mock out |
Darin Petkov | cd1666f | 2010-09-23 09:53:44 -0700 | [diff] [blame] | 32 | // methods within the class. There're explicit unit tests for the mocked out |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 33 | // methods. |
| 34 | class UpdateAttempterUnderTest : public UpdateAttempter { |
| 35 | public: |
Andrew de los Reyes | 000d895 | 2011-03-02 15:21:14 -0800 | [diff] [blame] | 36 | explicit UpdateAttempterUnderTest(MockDbusGlib* dbus) |
| 37 | : UpdateAttempter(NULL, NULL, dbus) {} |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | class UpdateAttempterTest : public ::testing::Test { |
| 41 | protected: |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 42 | UpdateAttempterTest() : attempter_(&dbus_), loop_(NULL) {} |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 43 | virtual void SetUp() { |
| 44 | EXPECT_EQ(NULL, attempter_.dbus_service_); |
| 45 | EXPECT_EQ(NULL, attempter_.prefs_); |
| 46 | EXPECT_EQ(NULL, attempter_.metrics_lib_); |
| 47 | EXPECT_EQ(NULL, attempter_.update_check_scheduler_); |
| 48 | EXPECT_EQ(0, attempter_.http_response_code_); |
| 49 | EXPECT_EQ(utils::kProcessPriorityNormal, attempter_.priority_); |
| 50 | EXPECT_EQ(NULL, attempter_.manage_priority_source_); |
| 51 | EXPECT_FALSE(attempter_.download_active_); |
| 52 | EXPECT_EQ(UPDATE_STATUS_IDLE, attempter_.status_); |
| 53 | EXPECT_EQ(0.0, attempter_.download_progress_); |
| 54 | EXPECT_EQ(0, attempter_.last_checked_time_); |
| 55 | EXPECT_EQ("0.0.0.0", attempter_.new_version_); |
| 56 | EXPECT_EQ(0, attempter_.new_size_); |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 57 | EXPECT_FALSE(attempter_.is_full_update_); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 58 | processor_ = new ActionProcessorMock(); |
| 59 | attempter_.processor_.reset(processor_); // Transfers ownership. |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 60 | attempter_.prefs_ = &prefs_; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 63 | void UpdateTestStart(); |
| 64 | void UpdateTestVerify(); |
| 65 | static gboolean StaticUpdateTestStart(gpointer data); |
| 66 | static gboolean StaticUpdateTestVerify(gpointer data); |
| 67 | |
Andrew de los Reyes | 000d895 | 2011-03-02 15:21:14 -0800 | [diff] [blame] | 68 | MockDbusGlib dbus_; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 69 | UpdateAttempterUnderTest attempter_; |
| 70 | ActionProcessorMock* processor_; |
Darin Petkov | 9c096d6 | 2010-11-17 14:49:04 -0800 | [diff] [blame] | 71 | NiceMock<PrefsMock> prefs_; |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 72 | GMainLoop* loop_; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
Darin Petkov | 1b00310 | 2010-11-30 10:18:36 -0800 | [diff] [blame] | 75 | TEST_F(UpdateAttempterTest, ActionCompletedDownloadTest) { |
| 76 | scoped_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, NULL)); |
| 77 | fetcher->FailTransfer(503); // Sets the HTTP response code. |
| 78 | DownloadAction action(&prefs_, fetcher.release()); |
| 79 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)).Times(0); |
| 80 | attempter_.ActionCompleted(NULL, &action, kActionCodeSuccess); |
| 81 | EXPECT_EQ(503, attempter_.http_response_code()); |
| 82 | EXPECT_EQ(UPDATE_STATUS_FINALIZING, attempter_.status()); |
| 83 | ASSERT_TRUE(attempter_.error_event_.get() == NULL); |
| 84 | } |
| 85 | |
| 86 | TEST_F(UpdateAttempterTest, ActionCompletedErrorTest) { |
| 87 | ActionMock action; |
| 88 | EXPECT_CALL(action, Type()).WillRepeatedly(Return("ActionMock")); |
| 89 | attempter_.status_ = UPDATE_STATUS_DOWNLOADING; |
| 90 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)) |
| 91 | .WillOnce(Return(false)); |
| 92 | attempter_.ActionCompleted(NULL, &action, kActionCodeError); |
| 93 | ASSERT_TRUE(attempter_.error_event_.get() != NULL); |
| 94 | } |
| 95 | |
| 96 | TEST_F(UpdateAttempterTest, ActionCompletedOmahaRequestTest) { |
| 97 | scoped_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, NULL)); |
| 98 | fetcher->FailTransfer(500); // Sets the HTTP response code. |
| 99 | OmahaRequestParams params; |
| 100 | OmahaRequestAction action(&prefs_, params, NULL, fetcher.release()); |
| 101 | ObjectCollectorAction<OmahaResponse> collector_action; |
| 102 | BondActions(&action, &collector_action); |
| 103 | OmahaResponse response; |
| 104 | response.poll_interval = 234; |
| 105 | action.SetOutputObject(response); |
| 106 | UpdateCheckScheduler scheduler(&attempter_); |
| 107 | attempter_.set_update_check_scheduler(&scheduler); |
| 108 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)).Times(0); |
| 109 | attempter_.ActionCompleted(NULL, &action, kActionCodeSuccess); |
| 110 | EXPECT_EQ(500, attempter_.http_response_code()); |
| 111 | EXPECT_EQ(UPDATE_STATUS_IDLE, attempter_.status()); |
| 112 | EXPECT_EQ(234, scheduler.poll_interval()); |
| 113 | ASSERT_TRUE(attempter_.error_event_.get() == NULL); |
| 114 | } |
| 115 | |
Darin Petkov | cd1666f | 2010-09-23 09:53:44 -0700 | [diff] [blame] | 116 | TEST_F(UpdateAttempterTest, RunAsRootConstructWithUpdatedMarkerTest) { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 117 | extern const char* kUpdateCompletedMarker; |
| 118 | const FilePath kMarker(kUpdateCompletedMarker); |
| 119 | EXPECT_EQ(0, file_util::WriteFile(kMarker, "", 0)); |
Andrew de los Reyes | 000d895 | 2011-03-02 15:21:14 -0800 | [diff] [blame] | 120 | MockDbusGlib dbus; |
| 121 | UpdateAttempterUnderTest attempter(&dbus); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 122 | EXPECT_EQ(UPDATE_STATUS_UPDATED_NEED_REBOOT, attempter.status()); |
| 123 | EXPECT_TRUE(file_util::Delete(kMarker, false)); |
| 124 | } |
| 125 | |
| 126 | TEST_F(UpdateAttempterTest, GetErrorCodeForActionTest) { |
| 127 | extern ActionExitCode GetErrorCodeForAction(AbstractAction* action, |
| 128 | ActionExitCode code); |
| 129 | EXPECT_EQ(kActionCodeSuccess, |
| 130 | GetErrorCodeForAction(NULL, kActionCodeSuccess)); |
| 131 | |
| 132 | OmahaRequestParams params; |
| 133 | OmahaRequestAction omaha_request_action(NULL, params, NULL, NULL); |
| 134 | EXPECT_EQ(kActionCodeOmahaRequestError, |
| 135 | GetErrorCodeForAction(&omaha_request_action, kActionCodeError)); |
Darin Petkov | 73058b4 | 2010-10-06 16:32:19 -0700 | [diff] [blame] | 136 | OmahaResponseHandlerAction omaha_response_handler_action(&prefs_); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 137 | EXPECT_EQ(kActionCodeOmahaResponseHandlerError, |
| 138 | GetErrorCodeForAction(&omaha_response_handler_action, |
| 139 | kActionCodeError)); |
Darin Petkov | 3aefa86 | 2010-12-07 14:45:00 -0800 | [diff] [blame] | 140 | FilesystemCopierAction filesystem_copier_action(false, false); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 141 | EXPECT_EQ(kActionCodeFilesystemCopierError, |
| 142 | GetErrorCodeForAction(&filesystem_copier_action, kActionCodeError)); |
Darin Petkov | 6d5dbf6 | 2010-11-08 16:09:55 -0800 | [diff] [blame] | 143 | PostinstallRunnerAction postinstall_runner_action; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 144 | EXPECT_EQ(kActionCodePostinstallRunnerError, |
| 145 | GetErrorCodeForAction(&postinstall_runner_action, |
| 146 | kActionCodeError)); |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 147 | ActionMock action_mock; |
| 148 | EXPECT_CALL(action_mock, Type()).Times(1).WillOnce(Return("ActionMock")); |
| 149 | EXPECT_EQ(kActionCodeError, |
| 150 | GetErrorCodeForAction(&action_mock, kActionCodeError)); |
| 151 | } |
| 152 | |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 153 | TEST_F(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest) { |
| 154 | attempter_.omaha_request_params_.delta_okay = true; |
| 155 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)) |
| 156 | .WillOnce(Return(false)); |
| 157 | attempter_.DisableDeltaUpdateIfNeeded(); |
| 158 | EXPECT_TRUE(attempter_.omaha_request_params_.delta_okay); |
| 159 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)) |
| 160 | .WillOnce(DoAll( |
| 161 | SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures - 1), |
| 162 | Return(true))); |
| 163 | attempter_.DisableDeltaUpdateIfNeeded(); |
| 164 | EXPECT_TRUE(attempter_.omaha_request_params_.delta_okay); |
| 165 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)) |
| 166 | .WillOnce(DoAll( |
| 167 | SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures), |
| 168 | Return(true))); |
| 169 | attempter_.DisableDeltaUpdateIfNeeded(); |
| 170 | EXPECT_FALSE(attempter_.omaha_request_params_.delta_okay); |
| 171 | EXPECT_CALL(prefs_, GetInt64(_, _)).Times(0); |
| 172 | attempter_.DisableDeltaUpdateIfNeeded(); |
| 173 | EXPECT_FALSE(attempter_.omaha_request_params_.delta_okay); |
| 174 | } |
| 175 | |
| 176 | TEST_F(UpdateAttempterTest, MarkDeltaUpdateFailureTest) { |
| 177 | attempter_.is_full_update_ = false; |
| 178 | EXPECT_CALL(prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)) |
| 179 | .WillOnce(Return(false)) |
| 180 | .WillOnce(DoAll(SetArgumentPointee<1>(-1), Return(true))) |
| 181 | .WillOnce(DoAll(SetArgumentPointee<1>(1), Return(true))) |
| 182 | .WillOnce(DoAll( |
| 183 | SetArgumentPointee<1>(UpdateAttempter::kMaxDeltaUpdateFailures), |
| 184 | Return(true))); |
Darin Petkov | 2dd0109 | 2010-10-08 15:43:05 -0700 | [diff] [blame] | 185 | EXPECT_CALL(prefs_, SetInt64(Ne(kPrefsDeltaUpdateFailures), _)) |
| 186 | .WillRepeatedly(Return(true)); |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 187 | EXPECT_CALL(prefs_, SetInt64(kPrefsDeltaUpdateFailures, 1)).Times(2); |
| 188 | EXPECT_CALL(prefs_, SetInt64(kPrefsDeltaUpdateFailures, 2)).Times(1); |
| 189 | EXPECT_CALL(prefs_, SetInt64(kPrefsDeltaUpdateFailures, |
| 190 | UpdateAttempter::kMaxDeltaUpdateFailures + 1)) |
| 191 | .Times(1); |
| 192 | for (int i = 0; i < 4; i ++) |
| 193 | attempter_.MarkDeltaUpdateFailure(); |
| 194 | } |
| 195 | |
Darin Petkov | 1b00310 | 2010-11-30 10:18:36 -0800 | [diff] [blame] | 196 | TEST_F(UpdateAttempterTest, ScheduleErrorEventActionNoEventTest) { |
| 197 | EXPECT_CALL(*processor_, EnqueueAction(_)).Times(0); |
| 198 | EXPECT_CALL(*processor_, StartProcessing()).Times(0); |
| 199 | attempter_.ScheduleErrorEventAction(); |
| 200 | } |
| 201 | |
| 202 | TEST_F(UpdateAttempterTest, ScheduleErrorEventActionTest) { |
| 203 | EXPECT_CALL(*processor_, |
| 204 | EnqueueAction(Property(&AbstractAction::Type, |
| 205 | OmahaRequestAction::StaticType()))) |
| 206 | .Times(1); |
| 207 | EXPECT_CALL(*processor_, StartProcessing()).Times(1); |
| 208 | attempter_.error_event_.reset(new OmahaEvent(OmahaEvent::kTypeUpdateComplete, |
| 209 | OmahaEvent::kResultError, |
| 210 | kActionCodeError)); |
| 211 | attempter_.ScheduleErrorEventAction(); |
| 212 | EXPECT_EQ(UPDATE_STATUS_REPORTING_ERROR_EVENT, attempter_.status()); |
| 213 | } |
| 214 | |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 215 | TEST_F(UpdateAttempterTest, UpdateStatusToStringTest) { |
| 216 | extern const char* UpdateStatusToString(UpdateStatus); |
| 217 | EXPECT_STREQ("UPDATE_STATUS_IDLE", UpdateStatusToString(UPDATE_STATUS_IDLE)); |
| 218 | EXPECT_STREQ("UPDATE_STATUS_CHECKING_FOR_UPDATE", |
| 219 | UpdateStatusToString(UPDATE_STATUS_CHECKING_FOR_UPDATE)); |
| 220 | EXPECT_STREQ("UPDATE_STATUS_UPDATE_AVAILABLE", |
| 221 | UpdateStatusToString(UPDATE_STATUS_UPDATE_AVAILABLE)); |
| 222 | EXPECT_STREQ("UPDATE_STATUS_DOWNLOADING", |
| 223 | UpdateStatusToString(UPDATE_STATUS_DOWNLOADING)); |
| 224 | EXPECT_STREQ("UPDATE_STATUS_VERIFYING", |
| 225 | UpdateStatusToString(UPDATE_STATUS_VERIFYING)); |
| 226 | EXPECT_STREQ("UPDATE_STATUS_FINALIZING", |
| 227 | UpdateStatusToString(UPDATE_STATUS_FINALIZING)); |
| 228 | EXPECT_STREQ("UPDATE_STATUS_UPDATED_NEED_REBOOT", |
| 229 | UpdateStatusToString(UPDATE_STATUS_UPDATED_NEED_REBOOT)); |
| 230 | EXPECT_STREQ("UPDATE_STATUS_REPORTING_ERROR_EVENT", |
| 231 | UpdateStatusToString(UPDATE_STATUS_REPORTING_ERROR_EVENT)); |
| 232 | EXPECT_STREQ("unknown status", |
| 233 | UpdateStatusToString(static_cast<UpdateStatus>(-1))); |
| 234 | } |
| 235 | |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 236 | gboolean UpdateAttempterTest::StaticUpdateTestStart(gpointer data) { |
| 237 | reinterpret_cast<UpdateAttempterTest*>(data)->UpdateTestStart(); |
| 238 | return FALSE; |
| 239 | } |
| 240 | |
| 241 | gboolean UpdateAttempterTest::StaticUpdateTestVerify(gpointer data) { |
| 242 | reinterpret_cast<UpdateAttempterTest*>(data)->UpdateTestVerify(); |
| 243 | return FALSE; |
| 244 | } |
| 245 | |
| 246 | namespace { |
| 247 | const string kActionTypes[] = { |
| 248 | OmahaRequestAction::StaticType(), |
| 249 | OmahaResponseHandlerAction::StaticType(), |
| 250 | FilesystemCopierAction::StaticType(), |
| 251 | FilesystemCopierAction::StaticType(), |
| 252 | OmahaRequestAction::StaticType(), |
| 253 | DownloadAction::StaticType(), |
| 254 | OmahaRequestAction::StaticType(), |
| 255 | FilesystemCopierAction::StaticType(), |
| 256 | FilesystemCopierAction::StaticType(), |
| 257 | PostinstallRunnerAction::StaticType(), |
| 258 | OmahaRequestAction::StaticType() |
| 259 | }; |
| 260 | } // namespace {} |
| 261 | |
| 262 | void UpdateAttempterTest::UpdateTestStart() { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 263 | attempter_.set_http_response_code(200); |
| 264 | InSequence s; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 265 | for (size_t i = 0; i < arraysize(kActionTypes); ++i) { |
| 266 | EXPECT_CALL(*processor_, |
| 267 | EnqueueAction(Property(&AbstractAction::Type, |
| 268 | kActionTypes[i]))).Times(1); |
| 269 | } |
| 270 | EXPECT_CALL(*processor_, StartProcessing()).Times(1); |
| 271 | |
Andrew de los Reyes | 4516810 | 2010-11-22 11:13:50 -0800 | [diff] [blame] | 272 | attempter_.Update("", "", false); |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 273 | g_idle_add(&StaticUpdateTestVerify, this); |
| 274 | } |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 275 | |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 276 | void UpdateAttempterTest::UpdateTestVerify() { |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 277 | EXPECT_EQ(0, attempter_.http_response_code()); |
| 278 | EXPECT_EQ(&attempter_, processor_->delegate()); |
| 279 | EXPECT_EQ(arraysize(kActionTypes), attempter_.actions_.size()); |
| 280 | for (size_t i = 0; i < arraysize(kActionTypes); ++i) { |
| 281 | EXPECT_EQ(kActionTypes[i], attempter_.actions_[i]->Type()); |
| 282 | } |
| 283 | EXPECT_EQ(attempter_.response_handler_action_.get(), |
| 284 | attempter_.actions_[1].get()); |
| 285 | DownloadAction* download_action = |
| 286 | dynamic_cast<DownloadAction*>(attempter_.actions_[5].get()); |
| 287 | ASSERT_TRUE(download_action != NULL); |
| 288 | EXPECT_EQ(&attempter_, download_action->delegate()); |
| 289 | EXPECT_EQ(UPDATE_STATUS_CHECKING_FOR_UPDATE, attempter_.status()); |
Darin Petkov | e6ef2f8 | 2011-03-07 17:31:11 -0800 | [diff] [blame^] | 290 | g_main_loop_quit(loop_); |
| 291 | } |
| 292 | |
| 293 | TEST_F(UpdateAttempterTest, UpdateTest) { |
| 294 | loop_ = g_main_loop_new(g_main_context_default(), FALSE); |
| 295 | g_idle_add(&StaticUpdateTestStart, this); |
| 296 | g_main_loop_run(loop_); |
| 297 | g_main_loop_unref(loop_); |
| 298 | loop_ = NULL; |
Darin Petkov | f42cc1c | 2010-09-01 09:03:02 -0700 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | } // namespace chromeos_update_engine |