1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef FLUTTER_TESTING_TEST_TIMEOUT_LISTENER_H_ |
6 | #define FLUTTER_TESTING_TEST_TIMEOUT_LISTENER_H_ |
7 | |
8 | #include <memory> |
9 | |
10 | #include "flutter/fml/macros.h" |
11 | #include "flutter/fml/task_runner.h" |
12 | #include "flutter/fml/thread.h" |
13 | #include "flutter/testing/testing.h" |
14 | |
15 | namespace flutter { |
16 | namespace testing { |
17 | |
18 | class PendingTests; |
19 | |
20 | class TestTimeoutListener : public ::testing::EmptyTestEventListener { |
21 | public: |
22 | TestTimeoutListener(fml::TimeDelta timeout); |
23 | |
24 | ~TestTimeoutListener(); |
25 | |
26 | private: |
27 | const fml::TimeDelta timeout_; |
28 | fml::Thread listener_thread_; |
29 | fml::RefPtr<fml::TaskRunner> listener_thread_runner_; |
30 | std::shared_ptr<PendingTests> pending_tests_; |
31 | |
32 | // |testing::EmptyTestEventListener| |
33 | void OnTestStart(const ::testing::TestInfo& test_info) override; |
34 | |
35 | // |testing::EmptyTestEventListener| |
36 | void OnTestEnd(const ::testing::TestInfo& test_info) override; |
37 | |
38 | FML_DISALLOW_COPY_AND_ASSIGN(TestTimeoutListener); |
39 | }; |
40 | |
41 | } // namespace testing |
42 | } // namespace flutter |
43 | |
44 | #endif // FLUTTER_TESTING_TEST_TIMEOUT_LISTENER_H_ |
45 |