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

Side by Side Diff: components/crash/content/app/fallback_crash_handling_win_unittest.cc

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Synced Created 3 years, 9 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
OLDNEW
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
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
OLDNEW
« no previous file with comments | « components/crash/content/app/fallback_crash_handler_win_unittest.cc ('k') | content/browser/mach_broker_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698