OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 EXPECT_EQ(test_size, | 120 EXPECT_EQ(test_size, |
121 file_util::WriteFileDescriptor(pt_pipe[1], test_str.c_str(), | 121 file_util::WriteFileDescriptor(pt_pipe[1], test_str.c_str(), |
122 test_size)); | 122 test_size)); |
123 } | 123 } |
124 | 124 |
125 all_data_received_->Wait(); | 125 all_data_received_->Wait(); |
126 | 126 |
127 // Send stop signal. It is not important which string we send. | 127 // Send stop signal. It is not important which string we send. |
128 EXPECT_EQ(1, file_util::WriteFileDescriptor(stop_pipe[1], "q", 1)); | 128 EXPECT_EQ(1, file_util::WriteFileDescriptor(stop_pipe[1], "q", 1)); |
129 | 129 |
130 EXPECT_NE(-1, HANDLE_EINTR(close(stop_pipe[1]))); | 130 EXPECT_NE(-1, IGNORE_EINTR(close(stop_pipe[1]))); |
131 EXPECT_NE(-1, HANDLE_EINTR(close(pt_pipe[1]))); | 131 EXPECT_NE(-1, IGNORE_EINTR(close(pt_pipe[1]))); |
132 | 132 |
133 output_watch_thread.Stop(); | 133 output_watch_thread.Stop(); |
134 } | 134 } |
135 | 135 |
136 scoped_ptr<base::WaitableEvent> all_data_received_; | 136 scoped_ptr<base::WaitableEvent> all_data_received_; |
137 | 137 |
138 private: | 138 private: |
139 ProcessWatcherExpectations expectations_; | 139 ProcessWatcherExpectations expectations_; |
140 std::vector<TestCase> exp; | 140 std::vector<TestCase> exp; |
141 }; | 141 }; |
(...skipping 20 matching lines...) Expand all Loading... |
162 // This will send '\0' to output wathcer. | 162 // This will send '\0' to output wathcer. |
163 test_cases.push_back(TestCase("", true)); | 163 test_cases.push_back(TestCase("", true)); |
164 // Let's verify that next input also gets detected (i.e. output watcher does | 164 // Let's verify that next input also gets detected (i.e. output watcher does |
165 // not exit after seeing '\0' from previous test case). | 165 // not exit after seeing '\0' from previous test case). |
166 test_cases.push_back(TestCase("a", true)); | 166 test_cases.push_back(TestCase("a", true)); |
167 | 167 |
168 RunTest(test_cases); | 168 RunTest(test_cases); |
169 }; | 169 }; |
170 | 170 |
171 } // namespace chromeos | 171 } // namespace chromeos |
OLD | NEW |