OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/crash/content/app/fallback_crash_handling_win.h" | 5 #include "components/crash/content/app/fallback_crash_handling_win.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 TEST_F(FallbackCrashHandlingTest, SetupAndRunAsFallbackCrashHandler) { | 58 TEST_F(FallbackCrashHandlingTest, SetupAndRunAsFallbackCrashHandler) { |
59 // Launch a subprocess to test the fallback handling implementation. | 59 // Launch a subprocess to test the fallback handling implementation. |
60 base::CommandLine cmd_line = base::GetMultiProcessTestChildBaseCommandLine(); | 60 base::CommandLine cmd_line = base::GetMultiProcessTestChildBaseCommandLine(); |
61 cmd_line.AppendSwitchPath("database", database_dir_.GetPath()); | 61 cmd_line.AppendSwitchPath("database", database_dir_.GetPath()); |
62 | 62 |
63 base::LaunchOptions options; | 63 base::LaunchOptions options; |
64 options.start_hidden = true; | 64 options.start_hidden = true; |
65 base::Process test_child = base::SpawnMultiProcessTestChild( | 65 base::SpawnChildResult spawn_child = base::SpawnMultiProcessTestChild( |
66 "FallbackCrashHandlingWinRunHandler", cmd_line, options); | 66 "FallbackCrashHandlingWinRunHandler", cmd_line, options); |
67 | 67 |
68 ASSERT_TRUE(test_child.IsValid()); | 68 ASSERT_TRUE(spawn_child.process.IsValid()); |
69 int exit_code = -1; | 69 int exit_code = -1; |
70 ASSERT_TRUE(test_child.WaitForExit(&exit_code)); | 70 ASSERT_TRUE(spawn_child.process.WaitForExit(&exit_code)); |
71 ASSERT_EQ(kFallbackCrashTerminationCode, static_cast<uint32_t>(exit_code)); | 71 ASSERT_EQ(kFallbackCrashTerminationCode, static_cast<uint32_t>(exit_code)); |
72 | 72 |
73 // Validate that the database contains one valid crash dump. | 73 // Validate that the database contains one valid crash dump. |
74 std::unique_ptr<crashpad::CrashReportDatabase> database = | 74 std::unique_ptr<crashpad::CrashReportDatabase> database = |
75 crashpad::CrashReportDatabase::InitializeWithoutCreating( | 75 crashpad::CrashReportDatabase::InitializeWithoutCreating( |
76 database_dir_.GetPath()); | 76 database_dir_.GetPath()); |
77 | 77 |
78 std::vector<crashpad::CrashReportDatabase::Report> reports; | 78 std::vector<crashpad::CrashReportDatabase::Report> reports; |
79 ASSERT_EQ(crashpad::CrashReportDatabase::kNoError, | 79 ASSERT_EQ(crashpad::CrashReportDatabase::kNoError, |
80 database->GetPendingReports(&reports)); | 80 database->GetPendingReports(&reports)); |
81 | 81 |
82 EXPECT_EQ(1U, reports.size()); | 82 EXPECT_EQ(1U, reports.size()); |
83 } | 83 } |
84 | 84 |
85 } // namespace crash_reporter | 85 } // namespace crash_reporter |
OLD | NEW |