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

Unified Diff: native_client_sdk/src/examples/tutorial/testing/testing.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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/examples/tutorial/testing/testing.cc
diff --git a/native_client_sdk/src/examples/tutorial/testing/testing.cc b/native_client_sdk/src/examples/tutorial/testing/testing.cc
index 57ae127b5cdb89e27e45d8d4ff39339f4505c799..b44b5a1070c992668e14f13af45092bdf94f64c7 100644
--- a/native_client_sdk/src/examples/tutorial/testing/testing.cc
+++ b/native_client_sdk/src/examples/tutorial/testing/testing.cc
@@ -3,24 +3,6 @@
// found in the LICENSE file.
#include "gtest/gtest.h"
-
-TEST(TestCase, SimpleTest) {
- EXPECT_EQ(4, 2*2);
-}
-
-TEST(TestCase, AnotherTest) {
- EXPECT_EQ(1, sizeof(char));
-}
-
-#if defined(SEL_LDR)
-
-int main(int argc, char* argv[]) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var.h"
#include "ppapi_simple/ps_main.h"
@@ -30,6 +12,14 @@ int main(int argc, char* argv[]) {
#undef PostMessage
#endif
+TEST(TestCase, SimpleTest) {
+ EXPECT_EQ(4, 2*2);
+}
+
+TEST(TestCase, AnotherTest) {
+ EXPECT_EQ(1, sizeof(char));
+}
+
class GTestEventListener : public ::testing::EmptyTestEventListener {
public:
// TestEventListener overrides.
@@ -59,14 +49,15 @@ class GTestEventListener : public ::testing::EmptyTestEventListener {
};
int example_main(int argc, char* argv[]) {
+ setenv("TERM", "xterm-256color", 0);
::testing::InitGoogleTest(&argc, argv);
- ::testing::UnitTest::GetInstance()->listeners()
- .Append(new GTestEventListener());
+ if (PSGetInstanceId() != 0) {
+ ::testing::UnitTest::GetInstance()->listeners()
+ .Append(new GTestEventListener());
+ }
return RUN_ALL_TESTS();
}
// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698