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 #ifndef GTEST_PPAPI_GTEST_RUNNER_H_ | 4 #ifndef GTEST_PPAPI_GTEST_RUNNER_H_ |
5 #define GTEST_PPAPI_GTEST_RUNNER_H_ | 5 #define GTEST_PPAPI_GTEST_RUNNER_H_ |
6 | 6 |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include "gtest_ppapi/thread_condition.h" | 8 #include "gtest_ppapi/thread_condition.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 class Instance; | 11 class Instance; |
12 } // namespace pp | 12 } // namespace pp |
13 | 13 |
14 // GTestRunner is a threaded singleton for running gtest-based unit tests. | 14 // GTestRunner is a threaded singleton for running gtest-based unit tests. |
15 class GTestRunner { | 15 class GTestRunner { |
16 public: | 16 public: |
17 // Factory function to create the background gtest thread and associated | 17 // Factory function to create the background gtest thread and associated |
18 // GTestRunner singleton. It is an error to call the factory function more | 18 // GTestRunner singleton. It is an error to call the factory function more |
19 // than once that raises an assert in debug mde. | 19 // than once that raises an assert in debug mode. |
20 // | 20 // |
21 // Parameters: | 21 // Parameters: |
22 // instance: the NaCl instance. | 22 // instance: the NaCl instance. |
23 // argc: arg count from pp::Instance::Init. | 23 // argc: arg count from pp::Instance::Init. |
24 // argv: the arguments from pp::Instance::Init. | 24 // argv: the arguments from pp::Instance::Init. |
25 static void CreateGTestRunnerThread(pp::Instance* instance, | 25 static void CreateGTestRunnerThread(pp::Instance* instance, |
26 int argc, char** argv); | 26 int argc, char** argv); |
27 | 27 |
28 // Get the GTestRunner singleton. | 28 // Get the GTestRunner singleton. |
29 // @return A pointer to the GTestRunner singleton. | 29 // @return A pointer to the GTestRunner singleton. |
(...skipping 18 matching lines...) Expand all Loading... |
48 // the thread run loop. | 48 // the thread run loop. |
49 enum Status { kIdle, kRunTests }; | 49 enum Status { kIdle, kRunTests }; |
50 ThreadCondition status_signal_; | 50 ThreadCondition status_signal_; |
51 Status status_; | 51 Status status_; |
52 | 52 |
53 static pthread_t g_test_runner_thread_; | 53 static pthread_t g_test_runner_thread_; |
54 static GTestRunner* gtest_runner_; | 54 static GTestRunner* gtest_runner_; |
55 }; | 55 }; |
56 | 56 |
57 #endif // GTEST_PPAPI_GTEST_RUNNER_H_ | 57 #endif // GTEST_PPAPI_GTEST_RUNNER_H_ |
OLD | NEW |