| Index: components/browser_watcher/postmortem_report_collector_unittest.cc
|
| diff --git a/components/browser_watcher/postmortem_report_collector_unittest.cc b/components/browser_watcher/postmortem_report_collector_unittest.cc
|
| index e48b6b8ea3dfa6340499e7b962a37d47d068d4dd..c99797356da83cba976927f99b6b3922e15696b8 100644
|
| --- a/components/browser_watcher/postmortem_report_collector_unittest.cc
|
| +++ b/components/browser_watcher/postmortem_report_collector_unittest.cc
|
| @@ -12,6 +12,7 @@
|
| #include <utility>
|
| #include <vector>
|
|
|
| +#include "base/bind.h"
|
| #include "base/debug/activity_tracker.h"
|
| #include "base/files/file.h"
|
| #include "base/files/file_path.h"
|
| @@ -88,10 +89,23 @@ class MockCrashReportDatabase : public CrashReportDatabase {
|
| CrashReportDatabase::OperationStatus(const UUID& uuid));
|
| };
|
|
|
| +void GetExecutableDetails(base::string16* product_name,
|
| + base::string16* version_number,
|
| + base::string16* channel_name) {
|
| + DCHECK_NE(nullptr, product_name);
|
| + DCHECK_NE(nullptr, version_number);
|
| + DCHECK_NE(nullptr, channel_name);
|
| +
|
| + *product_name = L"TestProduct";
|
| + *version_number = L"TestVersionNumber";
|
| + *channel_name = L"TestChannel";
|
| +}
|
| +
|
| // Used for testing CollectAndSubmitForUpload.
|
| class MockPostmortemReportCollector : public PostmortemReportCollector {
|
| public:
|
| - MockPostmortemReportCollector() {}
|
| + MockPostmortemReportCollector()
|
| + : PostmortemReportCollector(base::Bind(&GetExecutableDetails)) {}
|
|
|
| // A function that returns a unique_ptr cannot be mocked, so mock a function
|
| // that returns a raw pointer instead.
|
| @@ -263,7 +277,7 @@ TEST(PostmortemReportCollectorTest, GetDebugStateFilePaths) {
|
| ASSERT_NE(file.get(), nullptr);
|
| }
|
|
|
| - PostmortemReportCollector collector;
|
| + PostmortemReportCollector collector(base::Bind(&GetExecutableDetails));
|
| EXPECT_THAT(
|
| collector.GetDebugStateFilePaths(
|
| temp_dir.path(), FILE_PATH_LITERAL("foo*.pma"), excluded_paths),
|
| @@ -282,7 +296,7 @@ TEST(PostmortemReportCollectorTest, CollectEmptyFile) {
|
| ASSERT_TRUE(PathExists(file_path));
|
|
|
| // Validate collection: an empty file cannot suppport an analyzer.
|
| - PostmortemReportCollector collector;
|
| + PostmortemReportCollector collector(base::Bind(&GetExecutableDetails));
|
| std::unique_ptr<StabilityReport> report;
|
| ASSERT_EQ(PostmortemReportCollector::ANALYZER_CREATION_FAILED,
|
| collector.Collect(file_path, &report));
|
| @@ -307,7 +321,7 @@ TEST(PostmortemReportCollectorTest, CollectRandomFile) {
|
|
|
| // Validate collection: random content appears as though there is not
|
| // stability data.
|
| - PostmortemReportCollector collector;
|
| + PostmortemReportCollector collector(base::Bind(&GetExecutableDetails));
|
| std::unique_ptr<StabilityReport> report;
|
| ASSERT_EQ(PostmortemReportCollector::DEBUG_FILE_NO_DATA,
|
| collector.Collect(file_path, &report));
|
| @@ -401,7 +415,7 @@ class PostmortemReportCollectorCollectionTest : public testing::Test {
|
|
|
| TEST_F(PostmortemReportCollectorCollectionTest, CollectSuccess) {
|
| // Validate collection returns the expected report.
|
| - PostmortemReportCollector collector;
|
| + PostmortemReportCollector collector(base::Bind(&GetExecutableDetails));
|
| std::unique_ptr<StabilityReport> report;
|
| ASSERT_EQ(PostmortemReportCollector::SUCCESS,
|
| collector.Collect(debug_file_path(), &report));
|
|
|