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

Side by Side Diff: client/crash_report_database_test.cc

Issue 875043004: win: Partial fixes for client_test after CrashReportDatabase added (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « client/client.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 10 matching lines...) Expand all
21 #include "util/test/scoped_temp_dir.h" 21 #include "util/test/scoped_temp_dir.h"
22 22
23 namespace crashpad { 23 namespace crashpad {
24 namespace test { 24 namespace test {
25 namespace { 25 namespace {
26 26
27 bool FileExistsAtPath(const base::FilePath& path) { 27 bool FileExistsAtPath(const base::FilePath& path) {
28 #if defined(OS_POSIX) 28 #if defined(OS_POSIX)
29 struct stat st; 29 struct stat st;
30 return lstat(path.value().c_str(), &st) == 0; 30 return lstat(path.value().c_str(), &st) == 0;
31 #elif defined(OS_WIN)
32 struct _stat st;
33 return _wstat(path.value().c_str(), &st);
31 #else 34 #else
32 #error "Not implemented" 35 #error "Not implemented"
33 #endif 36 #endif
34 } 37 }
35 38
36 void CreateFile(const base::FilePath& path) { 39 void CreateFile(const base::FilePath& path) {
37 FileHandle handle = LoggingOpenFileForWrite(path, 40 FileHandle handle = LoggingOpenFileForWrite(path,
38 FileWriteMode::kCreateOrFail, 41 FileWriteMode::kCreateOrFail,
39 FilePermissions::kWorldReadable); 42 FilePermissions::kWorldReadable);
43 #if defined(OS_POSIX)
40 ASSERT_GE(handle, 0); 44 ASSERT_GE(handle, 0);
45 #elif defined(OS_WIN)
46 ASSERT_NE(handle, nullptr);
47 #endif
41 ASSERT_TRUE( 48 ASSERT_TRUE(
42 LoggingWriteFile(handle, path.value().c_str(), path.value().length())); 49 LoggingWriteFile(handle, path.value().c_str(), path.value().length()));
43 ASSERT_TRUE(LoggingCloseFile(handle)); 50 ASSERT_TRUE(LoggingCloseFile(handle));
44 } 51 }
45 52
46 class CrashReportDatabaseTest : public testing::Test { 53 class CrashReportDatabaseTest : public testing::Test {
47 protected: 54 protected:
48 // testing::Test: 55 // testing::Test:
49 void SetUp() override { 56 void SetUp() override {
50 db_ = CrashReportDatabase::Initialize(path()); 57 db_ = CrashReportDatabase::Initialize(path());
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 db()->GetReportForUploading(report.uuid, &upload_report_2)); 418 db()->GetReportForUploading(report.uuid, &upload_report_2));
412 EXPECT_FALSE(upload_report_2); 419 EXPECT_FALSE(upload_report_2);
413 420
414 EXPECT_EQ(CrashReportDatabase::kNoError, 421 EXPECT_EQ(CrashReportDatabase::kNoError,
415 db()->RecordUploadAttempt(upload_report, true, "")); 422 db()->RecordUploadAttempt(upload_report, true, ""));
416 } 423 }
417 424
418 } // namespace 425 } // namespace
419 } // namespace test 426 } // namespace test
420 } // namespace crashpad 427 } // namespace crashpad
OLDNEW
« no previous file with comments | « client/client.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698