| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 EXPECT_FALSE(delegate.success_); | 223 EXPECT_FALSE(delegate.success_); |
| 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 InstallPlan install_plan(true, "", "", "", ""); | 233 const char* kUrl = "http://some/url"; |
| 234 InstallPlan install_plan(true, kUrl, "", "", ""); |
| 234 feeder_action.set_obj(install_plan); | 235 feeder_action.set_obj(install_plan); |
| 235 FilesystemCopierAction copier_action(false); | 236 FilesystemCopierAction copier_action(false); |
| 236 ObjectCollectorAction<InstallPlan> collector_action; | 237 ObjectCollectorAction<InstallPlan> collector_action; |
| 237 | 238 |
| 238 BondActions(&feeder_action, &copier_action); | 239 BondActions(&feeder_action, &copier_action); |
| 239 BondActions(&copier_action, &collector_action); | 240 BondActions(&copier_action, &collector_action); |
| 240 | 241 |
| 241 processor.EnqueueAction(&feeder_action); | 242 processor.EnqueueAction(&feeder_action); |
| 242 processor.EnqueueAction(&copier_action); | 243 processor.EnqueueAction(&copier_action); |
| 243 processor.EnqueueAction(&collector_action); | 244 processor.EnqueueAction(&collector_action); |
| 244 processor.StartProcessing(); | 245 processor.StartProcessing(); |
| 245 EXPECT_FALSE(processor.IsRunning()); | 246 EXPECT_FALSE(processor.IsRunning()); |
| 246 EXPECT_TRUE(delegate.ran_); | 247 EXPECT_TRUE(delegate.ran_); |
| 247 EXPECT_TRUE(delegate.success_); | 248 EXPECT_TRUE(delegate.success_); |
| 249 EXPECT_EQ(kUrl, collector_action.object().download_url); |
| 248 } | 250 } |
| 249 | 251 |
| 250 TEST_F(FilesystemCopierActionTest, NonExistentDriveTest) { | 252 TEST_F(FilesystemCopierActionTest, NonExistentDriveTest) { |
| 251 ActionProcessor processor; | 253 ActionProcessor processor; |
| 252 FilesystemCopierActionTest2Delegate delegate; | 254 FilesystemCopierActionTest2Delegate delegate; |
| 253 | 255 |
| 254 processor.set_delegate(&delegate); | 256 processor.set_delegate(&delegate); |
| 255 | 257 |
| 256 ObjectFeederAction<InstallPlan> feeder_action; | 258 ObjectFeederAction<InstallPlan> feeder_action; |
| 257 InstallPlan install_plan(false, "", "", "/no/such/file", "/no/such/file"); | 259 InstallPlan install_plan(false, "", "", "/no/such/file", "/no/such/file"); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 274 ASSERT_EQ(0, getuid()); | 276 ASSERT_EQ(0, getuid()); |
| 275 DoTest(true, false, false); | 277 DoTest(true, false, false); |
| 276 } | 278 } |
| 277 | 279 |
| 278 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) { | 280 TEST_F(FilesystemCopierActionTest, RunAsRootTerminateEarlyTest) { |
| 279 ASSERT_EQ(0, getuid()); | 281 ASSERT_EQ(0, getuid()); |
| 280 DoTest(false, true, false); | 282 DoTest(false, true, false); |
| 281 } | 283 } |
| 282 | 284 |
| 283 } // namespace chromeos_update_engine | 285 } // namespace chromeos_update_engine |
| OLD | NEW |