Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: native_client_sdk/src/tests/nacl_io_socket_test/main.cc

Issue 412083002: [NaCl SDK] Allow ppapi_simple executables to run in both sel_ldr and in chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ::testing::InitGoogleTest(&argc, argv);
13 return RUN_ALL_TESTS();
14 }
15
16 #else
17
18 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
19 #include "ppapi/cpp/var.h" 9 #include "ppapi/cpp/var.h"
20 #include "ppapi_simple/ps_main.h" 10 #include "ppapi_simple/ps_main.h"
21 11
22 #if defined(WIN32) 12 #if defined(WIN32)
23 #include <Windows.h> 13 #include <Windows.h>
24 #undef PostMessage 14 #undef PostMessage
25 #endif 15 #endif
26 16
27 class GTestEventListener : public ::testing::EmptyTestEventListener { 17 class GTestEventListener : public ::testing::EmptyTestEventListener {
(...skipping 19 matching lines...) Expand all
47 virtual void OnTestEnd(const ::testing::TestInfo& test_info) { 37 virtual void OnTestEnd(const ::testing::TestInfo& test_info) {
48 std::stringstream msg; 38 std::stringstream msg;
49 msg << "end:" << test_info.test_case_name() << "." << test_info.name() 39 msg << "end:" << test_info.test_case_name() << "." << test_info.name()
50 << "," << (test_info.result()->Failed() ? "failed" : "ok"); 40 << "," << (test_info.result()->Failed() ? "failed" : "ok");
51 pp::Instance(PSGetInstanceId()).PostMessage(msg.str()); 41 pp::Instance(PSGetInstanceId()).PostMessage(msg.str());
52 } 42 }
53 }; 43 };
54 44
55 int example_main(int argc, char* argv[]) { 45 int example_main(int argc, char* argv[]) {
56 ::testing::InitGoogleTest(&argc, argv); 46 ::testing::InitGoogleTest(&argc, argv);
57 ::testing::UnitTest::GetInstance()->listeners() 47 if (PSGetInstanceId() != 0) {
58 .Append(new GTestEventListener()); 48 ::testing::UnitTest::GetInstance()->listeners()
49 .Append(new GTestEventListener());
50 }
59 return RUN_ALL_TESTS(); 51 return RUN_ALL_TESTS();
60 } 52 }
61 53
62 // Register the function to call once the Instance Object is initialized. 54 // Register the function to call once the Instance Object is initialized.
63 // see: pappi_simple/ps_main.h 55 // see: pappi_simple/ps_main.h
64 PPAPI_SIMPLE_REGISTER_MAIN(example_main); 56 PPAPI_SIMPLE_REGISTER_MAIN(example_main);
65
66 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698