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 | 4 |
5 #ifndef C_SALT_TEST_GTEST_NACL_ENVIRONMENT_H_ | 5 #ifndef GTEST_PPAPI_GTEST_NACL_ENVIRONMENT_H_ |
6 #define C_SALT_TEST_GTEST_NACL_ENVIRONMENT_H_ | 6 #define GTEST_PPAPI_GTEST_NACL_ENVIRONMENT_H_ |
7 | 7 |
8 #include <cassert> | 8 #include <cassert> |
9 #include "gtest/gtest.h" | 9 #include "gtest/gtest.h" |
10 | 10 |
11 namespace pp { | 11 namespace pp { |
12 class Instance; | 12 class Instance; |
13 } // namespace pp | 13 } // namespace pp |
14 | 14 |
15 namespace c_salt { | |
16 | |
17 // A custom environment for NaCl gtest. | 15 // A custom environment for NaCl gtest. |
18 class GTestNaclEnvironment : public ::testing::Environment { | 16 class GTestNaclEnvironment : public ::testing::Environment { |
19 public: | 17 public: |
20 // Set the global NaCl instance that will be shared by all the tests. | 18 // Set the global NaCl instance that will be shared by all the tests. |
21 static void set_global_instance(pp::Instance* instance) { | 19 static void set_global_instance(pp::Instance* instance) { |
22 global_instance_ = instance; | 20 global_instance_ = instance; |
23 } | 21 } |
24 | 22 |
25 // Get the global NaCl instance. | 23 // Get the global NaCl instance. |
26 static pp::Instance* global_instance() { return global_instance_; } | 24 static pp::Instance* global_instance() { return global_instance_; } |
27 | 25 |
28 // Environment overrides. | 26 // Environment overrides. |
29 virtual void SetUp(); | 27 virtual void SetUp(); |
30 virtual void TearDown(); | 28 virtual void TearDown(); |
31 | 29 |
32 private: | 30 private: |
33 static pp::Instance* global_instance_; | 31 static pp::Instance* global_instance_; |
34 }; | 32 }; |
35 | 33 |
36 } // namespace c_salt | 34 #endif // GTEST_PPAPI_GTEST_NACL_ENVIRONMENT_H_ |
37 | |
38 #endif // C_SALT_TEST_GTEST_NACL_ENVIRONMENT_H_ | |
39 | |
OLD | NEW |