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 | 8 |
9 #if defined(SEL_LDR) | 9 #if defined(SEL_LDR) |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); | 43 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 virtual void OnTestEnd(const ::testing::TestInfo& test_info) { | 47 virtual void OnTestEnd(const ::testing::TestInfo& test_info) { |
48 std::stringstream msg; | 48 std::stringstream msg; |
49 msg << "end:" << test_info.test_case_name() << "." << test_info.name() | 49 msg << "end:" << test_info.test_case_name() << "." << test_info.name() |
50 << "," << (test_info.result()->Failed() ? "failed" : "ok"); | 50 << "," << (test_info.result()->Failed() ? "failed" : "ok"); |
51 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); | 51 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); |
52 } | 52 } |
53 | |
54 virtual void OnTestProgramEnd(const ::testing::UnitTest&) { | |
55 pp::Instance(PSGetInstanceId()).PostMessage("testend"); | |
56 } | |
57 }; | 53 }; |
58 | 54 |
59 int example_main(int argc, char* argv[]) { | 55 int example_main(int argc, char* argv[]) { |
60 ::testing::InitGoogleTest(&argc, argv); | 56 ::testing::InitGoogleTest(&argc, argv); |
61 ::testing::UnitTest::GetInstance()->listeners() | 57 ::testing::UnitTest::GetInstance()->listeners() |
62 .Append(new GTestEventListener()); | 58 .Append(new GTestEventListener()); |
63 int result = RUN_ALL_TESTS(); | 59 return RUN_ALL_TESTS(); |
64 | |
65 // When running as an automated test, we don't want the final message | |
66 // ("testend") to be dropped, so don't exit. The web page will kill the | |
67 // plugin if it needs to. | |
68 while(1); | |
69 | |
70 // Silence the warning. | |
71 return result; | |
72 } | 60 } |
73 | 61 |
74 // Register the function to call once the Instance Object is initialized. | 62 // Register the function to call once the Instance Object is initialized. |
75 // see: pappi_simple/ps_main.h | 63 // see: pappi_simple/ps_main.h |
76 PPAPI_SIMPLE_REGISTER_MAIN(example_main); | 64 PPAPI_SIMPLE_REGISTER_MAIN(example_main); |
77 | 65 |
78 #endif | 66 #endif |
OLD | NEW |