From fff033497b70e96a5dcadb6ba9570c12b5921d74 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Thu, 24 Sep 2009 21:15:59 +0000 Subject: Publishes the even listener API (by Vlad Losev); adds OS-indicating macros to simplify gtest code (by Zhanyong Wan). git-svn-id: http://googletest.googlecode.com/svn/trunk@320 861a406c-534a-0410-8894-cb66d6ee9925 --- src/gtest-port.cc | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/gtest-port.cc') diff --git a/src/gtest-port.cc b/src/gtest-port.cc index ba9a9a2..de169e2 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -35,14 +35,14 @@ #include #include -#if GTEST_OS_WINDOWS -#ifndef _WIN32_WCE +#if GTEST_OS_WINDOWS_MOBILE +#include // For TerminateProcess() +#elif GTEST_OS_WINDOWS #include #include -#endif // _WIN32_WCE #else #include -#endif // GTEST_OS_WINDOWS +#endif // GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_MAC #include @@ -50,10 +50,6 @@ #include #endif // GTEST_OS_MAC -#ifdef _WIN32_WCE -#include // For TerminateProcess() -#endif // _WIN32_WCE - #include #include #include @@ -449,7 +445,7 @@ class CapturedStderr { public: // The ctor redirects stderr to a temporary file. CapturedStderr() { -#ifdef _WIN32_WCE +#if GTEST_OS_WINDOWS_MOBILE // Not supported on Windows CE. posix::Abort(); #else @@ -474,24 +470,24 @@ class CapturedStderr { fflush(NULL); dup2(captured_fd, kStdErrFileno); close(captured_fd); -#endif // _WIN32_WCE +#endif // GTEST_OS_WINDOWS_MOBILE } ~CapturedStderr() { -#ifndef _WIN32_WCE +#if !GTEST_OS_WINDOWS_MOBILE remove(filename_.c_str()); -#endif // _WIN32_WCE +#endif // !GTEST_OS_WINDOWS_MOBILE } // Stops redirecting stderr. void StopCapture() { -#ifndef _WIN32_WCE +#if !GTEST_OS_WINDOWS_MOBILE // Restores the original stream. fflush(NULL); dup2(uncaptured_fd_, kStdErrFileno); close(uncaptured_fd_); uncaptured_fd_ = -1; -#endif // !_WIN32_WCE +#endif // !GTEST_OS_WINDOWS_MOBILE } // Returns the name of the temporary file holding the stderr output. @@ -573,14 +569,14 @@ const ::std::vector& GetArgvs() { return g_argvs; } #endif // GTEST_HAS_DEATH_TEST -#ifdef _WIN32_WCE +#if GTEST_OS_WINDOWS_MOBILE namespace posix { void Abort() { DebugBreak(); TerminateProcess(GetCurrentProcess(), 1); } } // namespace posix -#endif // _WIN32_WCE +#endif // GTEST_OS_WINDOWS_MOBILE // Returns the name of the environment variable corresponding to the // given flag. For example, FlagToEnvVar("foo") will return -- cgit v1.2.3