OLD | NEW |
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 <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 "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include <glib.h> | 11 #include <glib.h> |
12 #include <gtest/gtest.h> | 12 #include <gtest/gtest.h> |
13 #include "update_engine/subprocess.h" | 13 #include "update_engine/subprocess.h" |
14 #include "update_engine/test_utils.h" | 14 #include "update_engine/test_utils.h" |
15 #include "update_engine/utils.h" | 15 #include "update_engine/utils.h" |
16 | 16 |
17 using std::string; | 17 using std::string; |
18 using std::vector; | 18 using std::vector; |
19 | 19 |
20 namespace chromeos_update_engine { | 20 namespace chromeos_update_engine { |
21 | 21 |
22 class SubprocessTest : public ::testing::Test { | 22 class SubprocessTest : public ::testing::Test { |
23 protected: | 23 protected: |
24 bool callback_done; | 24 bool callback_done; |
25 }; | 25 }; |
26 | 26 |
27 namespace { | 27 namespace { |
28 const int kLocalHttpPort = 8080; | 28 const int kLocalHttpPort = 8088; |
29 | 29 |
30 void Callback(int return_code, void *p) { | 30 void Callback(int return_code, void *p) { |
31 EXPECT_EQ(256, return_code); | 31 EXPECT_EQ(256, return_code); |
32 GMainLoop* loop = reinterpret_cast<GMainLoop*>(p); | 32 GMainLoop* loop = reinterpret_cast<GMainLoop*>(p); |
33 g_main_loop_quit(loop); | 33 g_main_loop_quit(loop); |
34 } | 34 } |
35 | 35 |
36 gboolean LaunchFalseInMainLoop(gpointer data) { | 36 gboolean LaunchFalseInMainLoop(gpointer data) { |
37 vector<string> cmd; | 37 vector<string> cmd; |
38 cmd.push_back("/bin/false"); | 38 cmd.push_back("/bin/false"); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 cancel_test_data.spawned = false; | 112 cancel_test_data.spawned = false; |
113 cancel_test_data.loop = loop; | 113 cancel_test_data.loop = loop; |
114 g_timeout_add(100, &StartAndCancelInRunLoop, &cancel_test_data); | 114 g_timeout_add(100, &StartAndCancelInRunLoop, &cancel_test_data); |
115 g_timeout_add(10, &ExitWhenDone, &cancel_test_data); | 115 g_timeout_add(10, &ExitWhenDone, &cancel_test_data); |
116 g_main_loop_run(loop); | 116 g_main_loop_run(loop); |
117 g_main_loop_unref(loop); | 117 g_main_loop_unref(loop); |
118 printf("here\n"); | 118 printf("here\n"); |
119 } | 119 } |
120 | 120 |
121 } // namespace chromeos_update_engine | 121 } // namespace chromeos_update_engine |
OLD | NEW |