Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: native_client_sdk/src/libraries/gtest_ppapi/gtest_runner.h

Issue 10854137: [NaCl SDK] gtest_ppapi library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove hacks Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 C_SALT_TEST_GTEST_RUNNER_H_ 4 #ifndef GTEST_PPAPI_GTEST_RUNNER_H_
5 #define C_SALT_TEST_GTEST_RUNNER_H_ 5 #define GTEST_PPAPI_GTEST_RUNNER_H_
6 6
7 #include "c_salt/threading/pthread_ext.h" 7 #include "gtest_ppapi/pthread_ext.h"
8 #include "c_salt/threading/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 namespace c_salt {
15
16 // GTestRunner is a threaded singleton for running gtest-based unit tests. 14 // GTestRunner is a threaded singleton for running gtest-based unit tests.
17 class GTestRunner { 15 class GTestRunner {
18 public: 16 public:
19 // Factory function to create the background gtest thread and associated 17 // Factory function to create the background gtest thread and associated
20 // 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
21 // than once that raises an assert in debug mde. 19 // than once that raises an assert in debug mde.
22 // 20 //
23 // Parameters: 21 // Parameters:
24 // instance: the NaCl instance. 22 // instance: the NaCl instance.
25 // argc: arg count from pp::Instance::Init. 23 // argc: arg count from pp::Instance::Init.
(...skipping 16 matching lines...) Expand all
42 GTestRunner(); 40 GTestRunner();
43 void Init(pp::Instance* instance, int argc, char** argv); 41 void Init(pp::Instance* instance, int argc, char** argv);
44 42
45 // The thread run loop exits once all test have run. 43 // The thread run loop exits once all test have run.
46 void RunLoop(); 44 void RunLoop();
47 45
48 private: 46 private:
49 // The status and associated status signal are used to control the state of 47 // The status and associated status signal are used to control the state of
50 // the thread run loop. 48 // the thread run loop.
51 enum Status { kIdle, kRunTests }; 49 enum Status { kIdle, kRunTests };
52 c_salt::threading::ThreadCondition status_signal_; 50 ThreadCondition status_signal_;
53 Status status_; 51 Status status_;
54 52
55 static pthread_t g_test_runner_thread_; 53 static pthread_t g_test_runner_thread_;
56 static GTestRunner* gtest_runner_; 54 static GTestRunner* gtest_runner_;
57 }; 55 };
58 56
59 } // namespace c_salt 57 #endif // GTEST_PPAPI_GTEST_RUNNER_H_
60
61 #endif // C_SALT_TEST_GTEST_RUNNER_H_
62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698