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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 }; | 83 }; |
84 | 84 |
85 class ProcessOutputWatcherTest : public testing::Test { | 85 class ProcessOutputWatcherTest : public testing::Test { |
86 public: | 86 public: |
87 ProcessOutputWatcherTest() : output_watch_thread_started_(false), | 87 ProcessOutputWatcherTest() : output_watch_thread_started_(false), |
88 failed_(false) { | 88 failed_(false) { |
89 } | 89 } |
90 | 90 |
91 virtual ~ProcessOutputWatcherTest() {} | 91 virtual ~ProcessOutputWatcherTest() {} |
92 | 92 |
93 virtual void TearDown() OVERRIDE { | 93 virtual void TearDown() override { |
94 if (output_watch_thread_started_) | 94 if (output_watch_thread_started_) |
95 output_watch_thread_->Stop(); | 95 output_watch_thread_->Stop(); |
96 } | 96 } |
97 | 97 |
98 void StartWatch(int pt, int stop) { | 98 void StartWatch(int pt, int stop) { |
99 // This will delete itself. | 99 // This will delete itself. |
100 ProcessOutputWatcher* crosh_watcher = new ProcessOutputWatcher(pt, stop, | 100 ProcessOutputWatcher* crosh_watcher = new ProcessOutputWatcher(pt, stop, |
101 base::Bind(&ProcessOutputWatcherTest::OnRead, base::Unretained(this))); | 101 base::Bind(&ProcessOutputWatcherTest::OnRead, base::Unretained(this))); |
102 crosh_watcher->Start(); | 102 crosh_watcher->Start(); |
103 } | 103 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |