Publishes the even listener API (by Vlad Losev); adds OS-indicating macros to simplify gtest code (by Zhanyong Wan).
This commit is contained in:
@@ -35,14 +35,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if GTEST_OS_WINDOWS
|
||||
#ifndef _WIN32_WCE
|
||||
#if GTEST_OS_WINDOWS_MOBILE
|
||||
#include <windows.h> // For TerminateProcess()
|
||||
#elif GTEST_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#include <sys/stat.h>
|
||||
#endif // _WIN32_WCE
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
#if GTEST_OS_MAC
|
||||
#include <mach/mach_init.h>
|
||||
@@ -50,10 +50,6 @@
|
||||
#include <mach/vm_map.h>
|
||||
#endif // GTEST_OS_MAC
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <windows.h> // For TerminateProcess()
|
||||
#endif // _WIN32_WCE
|
||||
|
||||
#include <gtest/gtest-spi.h>
|
||||
#include <gtest/gtest-message.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
@@ -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<String>& 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
|
||||
|
||||
Reference in New Issue
Block a user