OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 | 225 |
226 TEST_F(FilesystemCopierActionTest, FullUpdateTest) { | 226 TEST_F(FilesystemCopierActionTest, FullUpdateTest) { |
227 ActionProcessor processor; | 227 ActionProcessor processor; |
228 FilesystemCopierActionTest2Delegate delegate; | 228 FilesystemCopierActionTest2Delegate delegate; |
229 | 229 |
230 processor.set_delegate(&delegate); | 230 processor.set_delegate(&delegate); |
231 | 231 |
232 ObjectFeederAction<InstallPlan> feeder_action; | 232 ObjectFeederAction<InstallPlan> feeder_action; |
233 const char* kUrl = "http://some/url"; | 233 const char* kUrl = "http://some/url"; |
234 InstallPlan install_plan(true, kUrl, "", "", ""); | 234 InstallPlan install_plan(true, kUrl, 0, "", "", ""); |
235 feeder_action.set_obj(install_plan); | 235 feeder_action.set_obj(install_plan); |
236 FilesystemCopierAction copier_action(false); | 236 FilesystemCopierAction copier_action(false); |
237 ObjectCollectorAction<InstallPlan> collector_action; | 237 ObjectCollectorAction<InstallPlan> collector_action; |
238 | 238 |
239 BondActions(&feeder_action, &copier_action); | 239 BondActions(&feeder_action, &copier_action); |
240 BondActions(&copier_action, &collector_action); | 240 BondActions(&copier_action, &collector_action); |
241 | 241 |
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_TRUE(delegate.success_); | 248 EXPECT_TRUE(delegate.success_); |
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, NonExistentDriveTest) { | 252 TEST_F(FilesystemCopierActionTest, NonExistentDriveTest) { |
253 ActionProcessor processor; | 253 ActionProcessor processor; |
254 FilesystemCopierActionTest2Delegate delegate; | 254 FilesystemCopierActionTest2Delegate delegate; |
255 | 255 |
256 processor.set_delegate(&delegate); | 256 processor.set_delegate(&delegate); |
257 | 257 |
258 ObjectFeederAction<InstallPlan> feeder_action; | 258 ObjectFeederAction<InstallPlan> feeder_action; |
259 InstallPlan install_plan(false, "", "", "/no/such/file", "/no/such/file"); | 259 InstallPlan install_plan(false, "", 0, "", "/no/such/file", "/no/such/file"); |
260 feeder_action.set_obj(install_plan); | 260 feeder_action.set_obj(install_plan); |
261 FilesystemCopierAction copier_action(false); | 261 FilesystemCopierAction copier_action(false); |
262 ObjectCollectorAction<InstallPlan> collector_action; | 262 ObjectCollectorAction<InstallPlan> collector_action; |
263 | 263 |
264 BondActions(&copier_action, &collector_action); | 264 BondActions(&copier_action, &collector_action); |
265 | 265 |
266 processor.EnqueueAction(&feeder_action); | 266 processor.EnqueueAction(&feeder_action); |
267 processor.EnqueueAction(&copier_action); | 267 processor.EnqueueAction(&copier_action); |
268 processor.EnqueueAction(&collector_action); | 268 processor.EnqueueAction(&collector_action); |
269 processor.StartProcessing(); | 269 processor.StartProcessing(); |
270 EXPECT_FALSE(processor.IsRunning()); | 270 EXPECT_FALSE(processor.IsRunning()); |
271 EXPECT_TRUE(delegate.ran_); | 271 EXPECT_TRUE(delegate.ran_); |
272 EXPECT_FALSE(delegate.success_); | 272 EXPECT_FALSE(delegate.success_); |
273 } | 273 } |
274 | 274 |
275 TEST_F(FilesystemCopierActionTest, RunAsRootNoSpaceTest) { | 275 TEST_F(FilesystemCopierActionTest, RunAsRootNoSpaceTest) { |
276 ASSERT_EQ(0, getuid()); | 276 ASSERT_EQ(0, getuid()); |
277 DoTest(true, false, false); | 277 DoTest(true, false, false); |
278 } | 278 } |
279 | 279 |
280 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) { | 280 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) { |
281 ASSERT_EQ(0, getuid()); | 281 ASSERT_EQ(0, getuid()); |
282 DoTest(false, true, false); | 282 DoTest(false, true, false); |
283 } | 283 } |
284 | 284 |
285 } // namespace chromeos_update_engine | 285 } // namespace chromeos_update_engine |
OLD | NEW |