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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/posix/eintr_wrapper.h" | 15 #include "base/posix/eintr_wrapper.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "chromeos/process_proxy/process_output_watcher.h" | 19 #include "chromeos/process_proxy/process_output_watcher.h" |
20 | 20 |
21 namespace chromeos { | 21 namespace chromeos { |
22 | 22 |
23 struct TestCase { | 23 struct TestCase { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 test_cases.push_back(TestCase("testing output\n", false)); | 184 test_cases.push_back(TestCase("testing output\n", false)); |
185 test_cases.push_back(TestCase("testing error\n", false)); | 185 test_cases.push_back(TestCase("testing error\n", false)); |
186 test_cases.push_back(TestCase("testing error1\n", false)); | 186 test_cases.push_back(TestCase("testing error1\n", false)); |
187 test_cases.push_back(TestCase("testing output1\n", false)); | 187 test_cases.push_back(TestCase("testing output1\n", false)); |
188 test_cases.push_back(TestCase("testing output2\n", false)); | 188 test_cases.push_back(TestCase("testing output2\n", false)); |
189 test_cases.push_back(TestCase("testing output3\n", false)); | 189 test_cases.push_back(TestCase("testing output3\n", false)); |
190 test_cases.push_back(TestCase(VeryLongString(), false)); | 190 test_cases.push_back(TestCase(VeryLongString(), false)); |
191 test_cases.push_back(TestCase("testing error2\n", false)); | 191 test_cases.push_back(TestCase("testing error2\n", false)); |
192 | 192 |
193 RunTest(test_cases); | 193 RunTest(test_cases); |
194 }; | 194 } |
195 | 195 |
196 // http://crbug.com/396496 | 196 // http://crbug.com/396496 |
197 TEST_F(ProcessOutputWatcherTest, DISABLED_SplitUTF8Character) { | 197 TEST_F(ProcessOutputWatcherTest, DISABLED_SplitUTF8Character) { |
198 std::vector<TestCase> test_cases; | 198 std::vector<TestCase> test_cases; |
199 test_cases.push_back(TestCase("test1\xc2", false, "test1")); | 199 test_cases.push_back(TestCase("test1\xc2", false, "test1")); |
200 test_cases.push_back(TestCase("\xb5test1", false, "\xc2\xb5test1")); | 200 test_cases.push_back(TestCase("\xb5test1", false, "\xc2\xb5test1")); |
201 | 201 |
202 RunTest(test_cases); | 202 RunTest(test_cases); |
203 } | 203 } |
204 | 204 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 RunTest(test_cases); | 292 RunTest(test_cases); |
293 } | 293 } |
294 | 294 |
295 // http://crbug.com/396496 | 295 // http://crbug.com/396496 |
296 TEST_F(ProcessOutputWatcherTest, DISABLED_FourByteUTF8) { | 296 TEST_F(ProcessOutputWatcherTest, DISABLED_FourByteUTF8) { |
297 std::vector<TestCase> test_cases; | 297 std::vector<TestCase> test_cases; |
298 test_cases.push_back(TestCase("\xf0\xa4\xad", false, "")); | 298 test_cases.push_back(TestCase("\xf0\xa4\xad", false, "")); |
299 test_cases.push_back(TestCase("\xa2", false, "\xf0\xa4\xad\xa2")); | 299 test_cases.push_back(TestCase("\xa2", false, "\xf0\xa4\xad\xa2")); |
300 | 300 |
301 RunTest(test_cases); | 301 RunTest(test_cases); |
302 }; | 302 } |
303 | 303 |
304 // Verifies that sending '\0' generates PROCESS_OUTPUT_TYPE_OUT event and does | 304 // Verifies that sending '\0' generates PROCESS_OUTPUT_TYPE_OUT event and does |
305 // not terminate output watcher. | 305 // not terminate output watcher. |
306 // http://crbug.com/396496 | 306 // http://crbug.com/396496 |
307 TEST_F(ProcessOutputWatcherTest, DISABLED_SendNull) { | 307 TEST_F(ProcessOutputWatcherTest, DISABLED_SendNull) { |
308 std::vector<TestCase> test_cases; | 308 std::vector<TestCase> test_cases; |
309 // This will send '\0' to output watcher. | 309 // This will send '\0' to output watcher. |
310 test_cases.push_back(TestCase("", true)); | 310 test_cases.push_back(TestCase("", true)); |
311 // Let's verify that next input also gets detected (i.e. output watcher does | 311 // Let's verify that next input also gets detected (i.e. output watcher does |
312 // not exit after seeing '\0' from previous test case). | 312 // not exit after seeing '\0' from previous test case). |
313 test_cases.push_back(TestCase("a", true)); | 313 test_cases.push_back(TestCase("a", true)); |
314 | 314 |
315 RunTest(test_cases); | 315 RunTest(test_cases); |
316 }; | 316 } |
317 | 317 |
318 } // namespace chromeos | 318 } // namespace chromeos |
OLD | NEW |