win: Partial fixes for client_test after CrashReportDatabase added

- Dependency on compat required for sys/types.h inclusion for ssize_t.
- Test impl of stat to avoid #error
- FileHandle isn't int on Windows.

client_test no longer links though, as it's still lacking an
implementation of CrashReportDatabase of course.

R=rsesek@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/875043004
This commit is contained in:
Scott Graham 2015-01-26 13:56:20 -08:00
parent 7c9bd944ae
commit 7cd1639990
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@
'target_name': 'client', 'target_name': 'client',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'../compat/compat.gyp:compat',
'../third_party/mini_chromium/mini_chromium/base/base.gyp:base', '../third_party/mini_chromium/mini_chromium/base/base.gyp:base',
'../util/util.gyp:util', '../util/util.gyp:util',
], ],
@ -46,6 +47,7 @@
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'client', 'client',
'../compat/compat.gyp:compat',
'../third_party/gtest/gtest.gyp:gtest', '../third_party/gtest/gtest.gyp:gtest',
'../third_party/gtest/gtest.gyp:gtest_main', '../third_party/gtest/gtest.gyp:gtest_main',
'../third_party/mini_chromium/mini_chromium/base/base.gyp:base', '../third_party/mini_chromium/mini_chromium/base/base.gyp:base',

View File

@ -28,6 +28,9 @@ bool FileExistsAtPath(const base::FilePath& path) {
#if defined(OS_POSIX) #if defined(OS_POSIX)
struct stat st; struct stat st;
return lstat(path.value().c_str(), &st) == 0; return lstat(path.value().c_str(), &st) == 0;
#elif defined(OS_WIN)
struct _stat st;
return _wstat(path.value().c_str(), &st);
#else #else
#error "Not implemented" #error "Not implemented"
#endif #endif
@ -37,7 +40,11 @@ void CreateFile(const base::FilePath& path) {
FileHandle handle = LoggingOpenFileForWrite(path, FileHandle handle = LoggingOpenFileForWrite(path,
FileWriteMode::kCreateOrFail, FileWriteMode::kCreateOrFail,
FilePermissions::kWorldReadable); FilePermissions::kWorldReadable);
#if defined(OS_POSIX)
ASSERT_GE(handle, 0); ASSERT_GE(handle, 0);
#elif defined(OS_WIN)
ASSERT_NE(handle, nullptr);
#endif
ASSERT_TRUE( ASSERT_TRUE(
LoggingWriteFile(handle, path.value().c_str(), path.value().length())); LoggingWriteFile(handle, path.value().c_str(), path.value().length()));
ASSERT_TRUE(LoggingCloseFile(handle)); ASSERT_TRUE(LoggingCloseFile(handle));