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 C_SALT_TEST_GTEST_INSTANCE_H_ | 4 #ifndef GTEST_PPAPI_GTEST_INSTANCE_H_ |
5 #define C_SALT_TEST_GTEST_INSTANCE_H_ | 5 #define GTEST_PPAPI_GTEST_INSTANCE_H_ |
6 | 6 |
7 #include "ppapi/cpp/instance.h" | 7 #include "ppapi/cpp/instance.h" |
8 | 8 |
9 namespace c_salt { | |
10 | |
11 // GTestInstance is a NaCl instance specifically dedicated to running | 9 // GTestInstance is a NaCl instance specifically dedicated to running |
12 // gtest-based unit tests. It creates a GTestRunner thread/singleton pair as | 10 // gtest-based unit tests. It creates a GTestRunner thread/singleton pair as |
13 // part of its Init function and runs all registered gtests once it | 11 // part of its Init function and runs all registered gtests once it |
14 // receives a 'RunGTest' message in its post-message handler. Results from the | 12 // receives a 'RunGTest' message in its post-message handler. Results from the |
15 // test are posted back to JS through GTestEventListener. | 13 // test are posted back to JS through GTestEventListener. |
16 // | 14 // |
17 // All tests are run from a background thread and must be written accordingly. | 15 // All tests are run from a background thread and must be written accordingly. |
18 // Although that may complicate the test code a little, it allows the tests | 16 // Although that may complicate the test code a little, it allows the tests |
19 // to be synchronized. I.e. Each test is launched and the thread is blocked | 17 // to be synchronized. I.e. Each test is launched and the thread is blocked |
20 // until the outcome is known and reported. | 18 // until the outcome is known and reported. |
21 class GTestInstance : public pp::Instance { | 19 class GTestInstance : public pp::Instance { |
22 public: | 20 public: |
23 explicit GTestInstance(PP_Instance instance); | 21 explicit GTestInstance(PP_Instance instance); |
24 virtual ~GTestInstance(); | 22 virtual ~GTestInstance(); |
25 | 23 |
26 // pp::Instance overrides. | 24 // pp::Instance overrides. |
27 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | 25 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); |
28 virtual void HandleMessage(const pp::Var& var_message); | 26 virtual void HandleMessage(const pp::Var& var_message); |
29 }; | 27 }; |
30 | 28 |
31 } // namespace c_salt | 29 #endif // GTEST_PPAPI_GTEST_INSTANCE_H_ |
32 | |
33 #endif // C_SALT_TEST_GTEST_INSTANCE_H_ | |
34 | |
OLD | NEW |