| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser_watcher/postmortem_report_collector.h" | 5 #include "components/browser_watcher/postmortem_report_collector.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 ASSERT_EQ(data.size(), | 331 ASSERT_EQ(data.size(), |
| 332 fwrite(&data.at(0), sizeof(uint8_t), data.size(), file.get())); | 332 fwrite(&data.at(0), sizeof(uint8_t), data.size(), file.get())); |
| 333 } | 333 } |
| 334 ASSERT_TRUE(PathExists(file_path)); | 334 ASSERT_TRUE(PathExists(file_path)); |
| 335 | 335 |
| 336 // Validate collection: random content appears as though there is not | 336 // Validate collection: random content appears as though there is not |
| 337 // stability data. | 337 // stability data. |
| 338 PostmortemReportCollector collector(kProductName, kVersionNumber, | 338 PostmortemReportCollector collector(kProductName, kVersionNumber, |
| 339 kChannelName, nullptr); | 339 kChannelName, nullptr); |
| 340 StabilityReport report; | 340 StabilityReport report; |
| 341 ASSERT_EQ(DEBUG_FILE_NO_DATA, collector.CollectOneReport(file_path, &report)); | 341 ASSERT_NE(SUCCESS, collector.CollectOneReport(file_path, &report)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 namespace { | 344 namespace { |
| 345 | 345 |
| 346 // Parameters for the activity tracking. | 346 // Parameters for the activity tracking. |
| 347 const size_t kFileSize = 64 << 10; // 64 KiB | 347 const size_t kFileSize = 64 << 10; // 64 KiB |
| 348 const int kStackDepth = 6; | 348 const int kStackDepth = 6; |
| 349 const uint64_t kAllocatorId = 0; | 349 const uint64_t kAllocatorId = 0; |
| 350 const char kAllocatorName[] = "PostmortemReportCollectorCollectionTest"; | 350 const char kAllocatorName[] = "PostmortemReportCollectorCollectionTest"; |
| 351 const uint64_t kTaskSequenceNum = 42; | 351 const uint64_t kTaskSequenceNum = 42; |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 PostmortemReportCollector collector(kProductName, kVersionNumber, | 753 PostmortemReportCollector collector(kProductName, kVersionNumber, |
| 754 kChannelName, &analyzer); | 754 kChannelName, &analyzer); |
| 755 StabilityReport report; | 755 StabilityReport report; |
| 756 ASSERT_EQ(SUCCESS, collector.CollectOneReport(debug_file_path(), &report)); | 756 ASSERT_EQ(SUCCESS, collector.CollectOneReport(debug_file_path(), &report)); |
| 757 | 757 |
| 758 // Validate the report. | 758 // Validate the report. |
| 759 ASSERT_EQ(SystemState::CLEAN, report.system_state().session_state()); | 759 ASSERT_EQ(SystemState::CLEAN, report.system_state().session_state()); |
| 760 } | 760 } |
| 761 | 761 |
| 762 } // namespace browser_watcher | 762 } // namespace browser_watcher |
| OLD | NEW |