| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium 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 <sys/stat.h> | 5 #include <sys/stat.h> |
| 6 #include <sys/types.h> | 6 #include <sys/types.h> |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
| 11 #include "update_engine/postinstall_runner_action.h" | 11 #include "update_engine/postinstall_runner_action.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 dev[strlen(dev) - 1] = '\0'; | 109 dev[strlen(dev) - 1] = '\0'; |
| 110 | 110 |
| 111 if (do_losetup) | 111 if (do_losetup) |
| 112 ASSERT_EQ(0, System(string("losetup ") + dev + " " + cwd + "/image.dat")); | 112 ASSERT_EQ(0, System(string("losetup ") + dev + " " + cwd + "/image.dat")); |
| 113 | 113 |
| 114 ActionProcessor processor; | 114 ActionProcessor processor; |
| 115 ObjectFeederAction<InstallPlan> feeder_action; | 115 ObjectFeederAction<InstallPlan> feeder_action; |
| 116 InstallPlan install_plan; | 116 InstallPlan install_plan; |
| 117 install_plan.install_path = dev; | 117 install_plan.install_path = dev; |
| 118 feeder_action.set_obj(install_plan); | 118 feeder_action.set_obj(install_plan); |
| 119 PostinstallRunnerAction runner_action(true); | 119 PostinstallRunnerAction runner_action; |
| 120 BondActions(&feeder_action, &runner_action); | 120 BondActions(&feeder_action, &runner_action); |
| 121 ObjectCollectorAction<InstallPlan> collector_action; | 121 ObjectCollectorAction<InstallPlan> collector_action; |
| 122 BondActions(&runner_action, &collector_action); | 122 BondActions(&runner_action, &collector_action); |
| 123 PostinstActionProcessorDelegate delegate; | 123 PostinstActionProcessorDelegate delegate; |
| 124 processor.EnqueueAction(&feeder_action); | 124 processor.EnqueueAction(&feeder_action); |
| 125 processor.EnqueueAction(&runner_action); | 125 processor.EnqueueAction(&runner_action); |
| 126 processor.EnqueueAction(&collector_action); | 126 processor.EnqueueAction(&collector_action); |
| 127 processor.set_delegate(&delegate); | 127 processor.set_delegate(&delegate); |
| 128 processor.StartProcessing(); | 128 processor.StartProcessing(); |
| 129 ASSERT_FALSE(processor.IsRunning()) | 129 ASSERT_FALSE(processor.IsRunning()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 if (do_losetup) | 147 if (do_losetup) |
| 148 ASSERT_EQ(0, System(string("losetup -d ") + dev)); | 148 ASSERT_EQ(0, System(string("losetup -d ") + dev)); |
| 149 ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called")); | 149 ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called")); |
| 150 ASSERT_EQ(0, System(string("rm -f ") + cwd + "/image.dat")); | 150 ASSERT_EQ(0, System(string("rm -f ") + cwd + "/image.dat")); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Death tests don't seem to be working on Hardy | 153 // Death tests don't seem to be working on Hardy |
| 154 TEST_F(PostinstallRunnerActionTest, DISABLED_RunAsRootDeathTest) { | 154 TEST_F(PostinstallRunnerActionTest, DISABLED_RunAsRootDeathTest) { |
| 155 ASSERT_EQ(0, getuid()); | 155 ASSERT_EQ(0, getuid()); |
| 156 PostinstallRunnerAction runner_action(true); | 156 PostinstallRunnerAction runner_action; |
| 157 ASSERT_DEATH({ runner_action.TerminateProcessing(); }, | 157 ASSERT_DEATH({ runner_action.TerminateProcessing(); }, |
| 158 "postinstall_runner_action.h:.*] Check failed"); | 158 "postinstall_runner_action.h:.*] Check failed"); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace chromeos_update_engine | 161 } // namespace chromeos_update_engine |
| OLD | NEW |