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

Side by Side Diff: filesystem_copier_action_unittest.cc

Issue 3620013: AU: Resume interrupted update attempts. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix setup download Created 10 years, 2 months 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 | « filesystem_copier_action.cc ('k') | generate_delta_main.cc » ('j') | 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 <glib.h> 5 #include <glib.h>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include <gtest/gtest.h> 9 #include <gtest/gtest.h>
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 processor.EnqueueAction(&feeder_action); 242 processor.EnqueueAction(&feeder_action);
243 processor.EnqueueAction(&copier_action); 243 processor.EnqueueAction(&copier_action);
244 processor.EnqueueAction(&collector_action); 244 processor.EnqueueAction(&collector_action);
245 processor.StartProcessing(); 245 processor.StartProcessing();
246 EXPECT_FALSE(processor.IsRunning()); 246 EXPECT_FALSE(processor.IsRunning());
247 EXPECT_TRUE(delegate.ran_); 247 EXPECT_TRUE(delegate.ran_);
248 EXPECT_EQ(kActionCodeSuccess, delegate.code_); 248 EXPECT_EQ(kActionCodeSuccess, delegate.code_);
249 EXPECT_EQ(kUrl, collector_action.object().download_url); 249 EXPECT_EQ(kUrl, collector_action.object().download_url);
250 } 250 }
251 251
252 TEST_F(FilesystemCopierActionTest, ResumeTest) {
253 ActionProcessor processor;
254 FilesystemCopierActionTest2Delegate delegate;
255
256 processor.set_delegate(&delegate);
257
258 ObjectFeederAction<InstallPlan> feeder_action;
259 const char* kUrl = "http://some/url";
260 InstallPlan install_plan(false, true, kUrl, 0, "", "", "");
261 feeder_action.set_obj(install_plan);
262 FilesystemCopierAction copier_action(false);
263 ObjectCollectorAction<InstallPlan> collector_action;
264
265 BondActions(&feeder_action, &copier_action);
266 BondActions(&copier_action, &collector_action);
267
268 processor.EnqueueAction(&feeder_action);
269 processor.EnqueueAction(&copier_action);
270 processor.EnqueueAction(&collector_action);
271 processor.StartProcessing();
272 EXPECT_FALSE(processor.IsRunning());
273 EXPECT_TRUE(delegate.ran_);
274 EXPECT_EQ(kActionCodeSuccess, delegate.code_);
275 EXPECT_EQ(kUrl, collector_action.object().download_url);
276 }
277
252 TEST_F(FilesystemCopierActionTest, NonExistentDriveTest) { 278 TEST_F(FilesystemCopierActionTest, NonExistentDriveTest) {
253 ActionProcessor processor; 279 ActionProcessor processor;
254 FilesystemCopierActionTest2Delegate delegate; 280 FilesystemCopierActionTest2Delegate delegate;
255 281
256 processor.set_delegate(&delegate); 282 processor.set_delegate(&delegate);
257 283
258 ObjectFeederAction<InstallPlan> feeder_action; 284 ObjectFeederAction<InstallPlan> feeder_action;
259 InstallPlan install_plan(false, 285 InstallPlan install_plan(false,
260 false, 286 false,
261 "", 287 "",
(...skipping 20 matching lines...) Expand all
282 ASSERT_EQ(0, getuid()); 308 ASSERT_EQ(0, getuid());
283 DoTest(true, false, false); 309 DoTest(true, false, false);
284 } 310 }
285 311
286 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) { 312 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) {
287 ASSERT_EQ(0, getuid()); 313 ASSERT_EQ(0, getuid());
288 DoTest(false, true, false); 314 DoTest(false, true, false);
289 } 315 }
290 316
291 } // namespace chromeos_update_engine 317 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « filesystem_copier_action.cc ('k') | generate_delta_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698