Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: update_attempter_unittest.cc

Issue 4679003: AU: Remove obsolete postinst --postcommit call. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: fix copyrights Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « update_attempter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <base/file_util.h> 5 #include <base/file_util.h>
6 #include <gtest/gtest.h> 6 #include <gtest/gtest.h>
7 7
8 #include "update_engine/action_mock.h" 8 #include "update_engine/action_mock.h"
9 #include "update_engine/action_processor_mock.h" 9 #include "update_engine/action_processor_mock.h"
10 #include "update_engine/filesystem_copier_action.h" 10 #include "update_engine/filesystem_copier_action.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 OmahaRequestAction omaha_request_action(NULL, params, NULL, NULL); 78 OmahaRequestAction omaha_request_action(NULL, params, NULL, NULL);
79 EXPECT_EQ(kActionCodeOmahaRequestError, 79 EXPECT_EQ(kActionCodeOmahaRequestError,
80 GetErrorCodeForAction(&omaha_request_action, kActionCodeError)); 80 GetErrorCodeForAction(&omaha_request_action, kActionCodeError));
81 OmahaResponseHandlerAction omaha_response_handler_action(&prefs_); 81 OmahaResponseHandlerAction omaha_response_handler_action(&prefs_);
82 EXPECT_EQ(kActionCodeOmahaResponseHandlerError, 82 EXPECT_EQ(kActionCodeOmahaResponseHandlerError,
83 GetErrorCodeForAction(&omaha_response_handler_action, 83 GetErrorCodeForAction(&omaha_response_handler_action,
84 kActionCodeError)); 84 kActionCodeError));
85 FilesystemCopierAction filesystem_copier_action(false); 85 FilesystemCopierAction filesystem_copier_action(false);
86 EXPECT_EQ(kActionCodeFilesystemCopierError, 86 EXPECT_EQ(kActionCodeFilesystemCopierError,
87 GetErrorCodeForAction(&filesystem_copier_action, kActionCodeError)); 87 GetErrorCodeForAction(&filesystem_copier_action, kActionCodeError));
88 PostinstallRunnerAction postinstall_runner_action(true); 88 PostinstallRunnerAction postinstall_runner_action;
89 EXPECT_EQ(kActionCodePostinstallRunnerError, 89 EXPECT_EQ(kActionCodePostinstallRunnerError,
90 GetErrorCodeForAction(&postinstall_runner_action, 90 GetErrorCodeForAction(&postinstall_runner_action,
91 kActionCodeError)); 91 kActionCodeError));
92 ActionMock action_mock; 92 ActionMock action_mock;
93 EXPECT_CALL(action_mock, Type()).Times(1).WillOnce(Return("ActionMock")); 93 EXPECT_CALL(action_mock, Type()).Times(1).WillOnce(Return("ActionMock"));
94 EXPECT_EQ(kActionCodeError, 94 EXPECT_EQ(kActionCodeError,
95 GetErrorCodeForAction(&action_mock, kActionCodeError)); 95 GetErrorCodeForAction(&action_mock, kActionCodeError));
96 } 96 }
97 97
98 TEST_F(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest) { 98 TEST_F(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 InSequence s; 164 InSequence s;
165 const string kActionTypes[] = { 165 const string kActionTypes[] = {
166 OmahaRequestAction::StaticType(), 166 OmahaRequestAction::StaticType(),
167 OmahaResponseHandlerAction::StaticType(), 167 OmahaResponseHandlerAction::StaticType(),
168 FilesystemCopierAction::StaticType(), 168 FilesystemCopierAction::StaticType(),
169 FilesystemCopierAction::StaticType(), 169 FilesystemCopierAction::StaticType(),
170 OmahaRequestAction::StaticType(), 170 OmahaRequestAction::StaticType(),
171 DownloadAction::StaticType(), 171 DownloadAction::StaticType(),
172 OmahaRequestAction::StaticType(), 172 OmahaRequestAction::StaticType(),
173 PostinstallRunnerAction::StaticType(), 173 PostinstallRunnerAction::StaticType(),
174 PostinstallRunnerAction::StaticType(),
175 OmahaRequestAction::StaticType() 174 OmahaRequestAction::StaticType()
176 }; 175 };
177 for (size_t i = 0; i < arraysize(kActionTypes); ++i) { 176 for (size_t i = 0; i < arraysize(kActionTypes); ++i) {
178 EXPECT_CALL(*processor_, 177 EXPECT_CALL(*processor_,
179 EnqueueAction(Property(&AbstractAction::Type, 178 EnqueueAction(Property(&AbstractAction::Type,
180 kActionTypes[i]))).Times(1); 179 kActionTypes[i]))).Times(1);
181 } 180 }
182 EXPECT_CALL(*processor_, StartProcessing()).Times(1); 181 EXPECT_CALL(*processor_, StartProcessing()).Times(1);
183 182
184 attempter_.Update("", ""); 183 attempter_.Update("", "");
185 184
186 EXPECT_EQ(0, attempter_.http_response_code()); 185 EXPECT_EQ(0, attempter_.http_response_code());
187 EXPECT_EQ(&attempter_, processor_->delegate()); 186 EXPECT_EQ(&attempter_, processor_->delegate());
188 EXPECT_EQ(arraysize(kActionTypes), attempter_.actions_.size()); 187 EXPECT_EQ(arraysize(kActionTypes), attempter_.actions_.size());
189 for (size_t i = 0; i < arraysize(kActionTypes); ++i) { 188 for (size_t i = 0; i < arraysize(kActionTypes); ++i) {
190 EXPECT_EQ(kActionTypes[i], attempter_.actions_[i]->Type()); 189 EXPECT_EQ(kActionTypes[i], attempter_.actions_[i]->Type());
191 } 190 }
192 EXPECT_EQ(attempter_.response_handler_action_.get(), 191 EXPECT_EQ(attempter_.response_handler_action_.get(),
193 attempter_.actions_[1].get()); 192 attempter_.actions_[1].get());
194 DownloadAction* download_action = 193 DownloadAction* download_action =
195 dynamic_cast<DownloadAction*>(attempter_.actions_[5].get()); 194 dynamic_cast<DownloadAction*>(attempter_.actions_[5].get());
196 ASSERT_TRUE(download_action != NULL); 195 ASSERT_TRUE(download_action != NULL);
197 EXPECT_EQ(&attempter_, download_action->delegate()); 196 EXPECT_EQ(&attempter_, download_action->delegate());
198 EXPECT_EQ(UPDATE_STATUS_CHECKING_FOR_UPDATE, attempter_.status()); 197 EXPECT_EQ(UPDATE_STATUS_CHECKING_FOR_UPDATE, attempter_.status());
199 } 198 }
200 199
201 } // namespace chromeos_update_engine 200 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « update_attempter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698