| 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_handler_win.h" | 5 #include "components/crash/content/app/fallback_crash_handler_win.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // the handler takes it over. | 162 // the handler takes it over. |
| 163 EXPECT_TRUE(handler.ParseCommandLine(cmd_line)); | 163 EXPECT_TRUE(handler.ParseCommandLine(cmd_line)); |
| 164 self_handle_ = base::kNullProcessHandle; | 164 self_handle_ = base::kNullProcessHandle; |
| 165 } | 165 } |
| 166 | 166 |
| 167 TEST_F(FallbackCrashHandlerWinTest, GenerateCrashDump) { | 167 TEST_F(FallbackCrashHandlerWinTest, GenerateCrashDump) { |
| 168 base::CommandLine cmd_line = base::GetMultiProcessTestChildBaseCommandLine(); | 168 base::CommandLine cmd_line = base::GetMultiProcessTestChildBaseCommandLine(); |
| 169 cmd_line.AppendSwitchPath("directory", database_dir_.GetPath()); | 169 cmd_line.AppendSwitchPath("directory", database_dir_.GetPath()); |
| 170 base::LaunchOptions options; | 170 base::LaunchOptions options; |
| 171 options.start_hidden = true; | 171 options.start_hidden = true; |
| 172 base::Process test_child = base::SpawnMultiProcessTestChild( | 172 base::SpawnChildResult spawn_child = base::SpawnMultiProcessTestChild( |
| 173 "FallbackCrashHandlerWinMain", cmd_line, options); | 173 "FallbackCrashHandlerWinMain", cmd_line, options); |
| 174 | 174 |
| 175 ASSERT_TRUE(test_child.IsValid()); | 175 ASSERT_TRUE(spawn_child.process.IsValid()); |
| 176 int exit_code = -1; | 176 int exit_code = -1; |
| 177 ASSERT_TRUE(test_child.WaitForExit(&exit_code)); | 177 ASSERT_TRUE(spawn_child.process.WaitForExit(&exit_code)); |
| 178 ASSERT_EQ(0, exit_code); | 178 ASSERT_EQ(0, exit_code); |
| 179 | 179 |
| 180 // Validate that the database contains one valid crash dump. | 180 // Validate that the database contains one valid crash dump. |
| 181 std::unique_ptr<crashpad::CrashReportDatabase> database = | 181 std::unique_ptr<crashpad::CrashReportDatabase> database = |
| 182 crashpad::CrashReportDatabase::InitializeWithoutCreating( | 182 crashpad::CrashReportDatabase::InitializeWithoutCreating( |
| 183 database_dir_.GetPath()); | 183 database_dir_.GetPath()); |
| 184 | 184 |
| 185 std::vector<crashpad::CrashReportDatabase::Report> reports; | 185 std::vector<crashpad::CrashReportDatabase::Report> reports; |
| 186 ASSERT_EQ(crashpad::CrashReportDatabase::kNoError, | 186 ASSERT_EQ(crashpad::CrashReportDatabase::kNoError, |
| 187 database->GetPendingReports(&reports)); | 187 database->GetPendingReports(&reports)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // on memory :). | 257 // on memory :). |
| 258 EXPECT_NE(0U, int_value); | 258 EXPECT_NE(0U, int_value); |
| 259 | 259 |
| 260 it = parameters.find("SystemCommitLimit"); | 260 it = parameters.find("SystemCommitLimit"); |
| 261 EXPECT_NE(parameters.end(), it); | 261 EXPECT_NE(parameters.end(), it); |
| 262 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); | 262 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); |
| 263 EXPECT_NE(0U, int_value); | 263 EXPECT_NE(0U, int_value); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace crash_reporter | 266 } // namespace crash_reporter |
| OLD | NEW |