OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 #include <glib.h> | 7 #include <glib.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
10 #include "update_engine/download_action.h" | 10 #include "update_engine/download_action.h" |
11 #include "update_engine/install_action.h" | 11 #include "update_engine/install_action.h" |
12 #include "update_engine/libcurl_http_fetcher.h" | 12 #include "update_engine/libcurl_http_fetcher.h" |
13 #include "update_engine/mock_http_fetcher.h" | 13 #include "update_engine/mock_http_fetcher.h" |
| 14 #include "update_engine/omaha_request_action.h" |
14 #include "update_engine/omaha_request_prep_action.h" | 15 #include "update_engine/omaha_request_prep_action.h" |
15 #include "update_engine/omaha_response_handler_action.h" | 16 #include "update_engine/omaha_response_handler_action.h" |
16 #include "update_engine/postinstall_runner_action.h" | 17 #include "update_engine/postinstall_runner_action.h" |
17 #include "update_engine/set_bootable_flag_action.h" | 18 #include "update_engine/set_bootable_flag_action.h" |
18 #include "update_engine/test_utils.h" | 19 #include "update_engine/test_utils.h" |
19 #include "update_engine/update_check_action.h" | |
20 #include "update_engine/utils.h" | 20 #include "update_engine/utils.h" |
21 | 21 |
22 // The tests here integrate many Action objects together. This test that | 22 // The tests here integrate many Action objects together. This test that |
23 // the objects work well together, whereas most other tests focus on a single | 23 // the objects work well together, whereas most other tests focus on a single |
24 // action at a time. | 24 // action at a time. |
25 | 25 |
26 namespace chromeos_update_engine { | 26 namespace chromeos_update_engine { |
27 | 27 |
28 using std::string; | 28 using std::string; |
29 using std::vector; | 29 using std::vector; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ASSERT_EQ(0, getuid()); | 98 ASSERT_EQ(0, getuid()); |
99 GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE); | 99 GMainLoop *loop = g_main_loop_new(g_main_context_default(), FALSE); |
100 | 100 |
101 ActionProcessor processor; | 101 ActionProcessor processor; |
102 IntegrationTestProcessorDelegate delegate; | 102 IntegrationTestProcessorDelegate delegate; |
103 delegate.set_loop(loop); | 103 delegate.set_loop(loop); |
104 processor.set_delegate(&delegate); | 104 processor.set_delegate(&delegate); |
105 | 105 |
106 // Actions: | 106 // Actions: |
107 OmahaRequestPrepAction request_prep_action(false); | 107 OmahaRequestPrepAction request_prep_action(false); |
108 UpdateCheckAction update_check_action(new LibcurlHttpFetcher); | 108 OmahaRequestAction update_check_action(new LibcurlHttpFetcher); |
109 OmahaResponseHandlerAction response_handler_action; | 109 OmahaResponseHandlerAction response_handler_action; |
110 DownloadAction download_action(new LibcurlHttpFetcher); | 110 DownloadAction download_action(new LibcurlHttpFetcher); |
111 InstallAction install_action; | 111 InstallAction install_action; |
112 PostinstallRunnerAction postinstall_runner_action; | 112 PostinstallRunnerAction postinstall_runner_action; |
113 SetBootableFlagAction set_bootable_flag_action; | 113 SetBootableFlagAction set_bootable_flag_action; |
114 | 114 |
115 // Enqueue the actions | 115 // Enqueue the actions |
116 processor.EnqueueAction(&request_prep_action); | 116 processor.EnqueueAction(&request_prep_action); |
117 processor.EnqueueAction(&update_check_action); | 117 processor.EnqueueAction(&update_check_action); |
118 processor.EnqueueAction(&response_handler_action); | 118 processor.EnqueueAction(&response_handler_action); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 "/tmp/update_engine_test_postinst_out.txt", | 183 "/tmp/update_engine_test_postinst_out.txt", |
184 &file_data)); | 184 &file_data)); |
185 EXPECT_EQ("POSTINST_DONE\n", file_data); | 185 EXPECT_EQ("POSTINST_DONE\n", file_data); |
186 | 186 |
187 // cleanup | 187 // cleanup |
188 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); | 188 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); |
189 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); | 189 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); |
190 } | 190 } |
191 | 191 |
192 } // namespace chromeos_update_engine | 192 } // namespace chromeos_update_engine |
OLD | NEW |