OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 #ifndef C_SALT_TEST_GTEST_INSTANCE_H_ | |
5 #define C_SALT_TEST_GTEST_INSTANCE_H_ | |
6 | |
7 #include "ppapi/cpp/instance.h" | |
8 | |
9 namespace c_salt { | |
10 | |
11 // GTestInstance is a NaCl instance specifically dedicated to running | |
12 // 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 | |
14 // receives a 'RunGTest' message in its post-message handler. Results from the | |
15 // test are posted back to JS through GTestEventListener. | |
16 // | |
17 // 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 | |
19 // to be synchronized. I.e. Each test is launched and the thread is blocked | |
20 // until the outcome is known and reported. | |
21 class GTestInstance : public pp::Instance { | |
22 public: | |
23 explicit GTestInstance(PP_Instance instance); | |
24 virtual ~GTestInstance(); | |
25 | |
26 // pp::Instance overrides. | |
27 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); | |
28 virtual void HandleMessage(const pp::Var& var_message); | |
29 }; | |
30 | |
31 } // namespace c_salt | |
32 | |
33 #endif // C_SALT_TEST_GTEST_INSTANCE_H_ | |
34 | |
OLD | NEW |