OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "gtest/gtest.h" | 7 #include "gtest/gtest.h" |
8 | |
9 #if defined(SEL_LDR) | |
10 | |
11 int main(int argc, char* argv[]) { | |
12 setenv("TERM", "xterm-256color", 0); | |
13 ::testing::InitGoogleTest(&argc, argv); | |
14 return RUN_ALL_TESTS(); | |
15 } | |
16 | |
17 #else | |
18 | |
19 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
20 #include "ppapi/cpp/var.h" | 9 #include "ppapi/cpp/var.h" |
21 #include "ppapi_simple/ps_main.h" | 10 #include "ppapi_simple/ps_main.h" |
22 | 11 |
23 #if defined(WIN32) | 12 #if defined(WIN32) |
24 #include <Windows.h> | 13 #include <Windows.h> |
25 #undef PostMessage | 14 #undef PostMessage |
26 #endif | 15 #endif |
27 | 16 |
28 class GTestEventListener : public ::testing::EmptyTestEventListener { | 17 class GTestEventListener : public ::testing::EmptyTestEventListener { |
(...skipping 18 matching lines...) Expand all Loading... |
47 | 36 |
48 virtual void OnTestEnd(const ::testing::TestInfo& test_info) { | 37 virtual void OnTestEnd(const ::testing::TestInfo& test_info) { |
49 std::stringstream msg; | 38 std::stringstream msg; |
50 msg << "end:" << test_info.test_case_name() << "." << test_info.name() | 39 msg << "end:" << test_info.test_case_name() << "." << test_info.name() |
51 << "," << (test_info.result()->Failed() ? "failed" : "ok"); | 40 << "," << (test_info.result()->Failed() ? "failed" : "ok"); |
52 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); | 41 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); |
53 } | 42 } |
54 }; | 43 }; |
55 | 44 |
56 int example_main(int argc, char* argv[]) { | 45 int example_main(int argc, char* argv[]) { |
| 46 setenv("TERM", "xterm-256color", 0); |
57 ::testing::InitGoogleTest(&argc, argv); | 47 ::testing::InitGoogleTest(&argc, argv); |
58 ::testing::UnitTest::GetInstance()->listeners() | 48 if (PSGetInstanceId() != 0) { |
59 .Append(new GTestEventListener()); | 49 ::testing::UnitTest::GetInstance()->listeners() |
| 50 .Append(new GTestEventListener()); |
| 51 } |
60 return RUN_ALL_TESTS(); | 52 return RUN_ALL_TESTS(); |
61 } | 53 } |
62 | 54 |
63 // Register the function to call once the Instance Object is initialized. | 55 // Register the function to call once the Instance Object is initialized. |
64 // see: pappi_simple/ps_main.h | 56 // see: pappi_simple/ps_main.h |
65 PPAPI_SIMPLE_REGISTER_MAIN(example_main); | 57 PPAPI_SIMPLE_REGISTER_MAIN(example_main); |
66 | |
67 #endif | |
OLD | NEW |