Commit 2459bd0c authored by Joshua Peraza's avatar Joshua Peraza Committed by Commit Bot

Use CrashReportDatabase to access crash reports

Using the CrashReportDatabase interface is more robust against changing
database implementations than accessing crash reports directly.

Change-Id: I6ef699a4a98d772364ff2c5f2de118a5fecc978a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1633315Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664342}
parent 1cb9e275
...@@ -784,6 +784,10 @@ test("headless_browsertests") { ...@@ -784,6 +784,10 @@ test("headless_browsertests") {
] ]
} }
if (is_mac) {
deps += [ "//third_party/crashpad/crashpad/client" ]
}
if (enable_basic_printing) { if (enable_basic_printing) {
deps += [ deps += [
"//components/printing/browser", "//components/printing/browser",
......
specific_include_rules = { specific_include_rules = {
"headless_browser_browsertest.cc": [
"+third_party/crashpad/crashpad/client",
],
"headless_content_main_delegate.cc": [ "headless_content_main_delegate.cc": [
"+cc/base/switches.h", "+cc/base/switches.h",
"+components/viz/common/switches.h", "+components/viz/common/switches.h",
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#if defined(OS_MACOSX)
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#endif
using testing::UnorderedElementsAre; using testing::UnorderedElementsAre;
namespace headless { namespace headless {
...@@ -486,17 +490,22 @@ IN_PROC_BROWSER_TEST_F(CrashReporterTest, MAYBE_GenerateMinidump) { ...@@ -486,17 +490,22 @@ IN_PROC_BROWSER_TEST_F(CrashReporterTest, MAYBE_GenerateMinidump) {
// Check that one minidump got created. // Check that one minidump got created.
{ {
#if defined(OS_MACOSX)
// Mac outputs dumps in the 'pending' directory.
crash_dumps_dir_ = crash_dumps_dir_.Append("pending");
#endif
base::ThreadRestrictions::SetIOAllowed(true); base::ThreadRestrictions::SetIOAllowed(true);
#if defined(OS_MACOSX)
auto database = crashpad::CrashReportDatabase::Initialize(crash_dumps_dir_);
std::vector<crashpad::CrashReportDatabase::Report> reports;
ASSERT_EQ(database->GetPendingReports(&reports),
crashpad::CrashReportDatabase::kNoError);
EXPECT_EQ(reports.size(), 1u);
#else
base::FileEnumerator it(crash_dumps_dir_, /* recursive */ false, base::FileEnumerator it(crash_dumps_dir_, /* recursive */ false,
base::FileEnumerator::FILES); base::FileEnumerator::FILES);
base::FilePath minidump = it.Next(); base::FilePath minidump = it.Next();
EXPECT_FALSE(minidump.empty()); EXPECT_FALSE(minidump.empty());
EXPECT_EQ(FILE_PATH_LITERAL(".dmp"), minidump.Extension()); EXPECT_EQ(FILE_PATH_LITERAL(".dmp"), minidump.Extension());
EXPECT_TRUE(it.Next().empty()); EXPECT_TRUE(it.Next().empty());
#endif
} }
web_contents_->RemoveObserver(this); web_contents_->RemoveObserver(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment