| 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_minidump_writer.h" | 5 #include "components/browser_watcher/postmortem_minidump_writer.h" |
| 6 | 6 |
| 7 #include <windows.h> // NOLINT | 7 #include <windows.h> // NOLINT |
| 8 #include <dbghelp.h> | 8 #include <dbghelp.h> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Create a stability report. | 37 // Create a stability report. |
| 38 // TODO(manzagop): flesh out the report once proto is more detailed. | 38 // TODO(manzagop): flesh out the report once proto is more detailed. |
| 39 ProcessState* process_state = expected_report_.add_process_states(); | 39 ProcessState* process_state = expected_report_.add_process_states(); |
| 40 CodeModule* module = process_state->add_modules(); | 40 CodeModule* module = process_state->add_modules(); |
| 41 module->set_base_address(1024); | 41 module->set_base_address(1024); |
| 42 module->set_code_file("some_code_file.dll"); | 42 module->set_code_file("some_code_file.dll"); |
| 43 | 43 |
| 44 // Write the minidump. | 44 // Write the minidump. |
| 45 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 45 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 46 minidump_path_ = temp_dir_.path().AppendASCII("minidump.dmp"); | 46 minidump_path_ = temp_dir_.GetPath().AppendASCII("minidump.dmp"); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool WriteDump() { | 49 bool WriteDump() { |
| 50 base::win::ScopedHandle file_handle(::CreateFile( | 50 base::win::ScopedHandle file_handle(::CreateFile( |
| 51 minidump_path_.value().c_str(), GENERIC_READ | GENERIC_WRITE, | 51 minidump_path_.value().c_str(), GENERIC_READ | GENERIC_WRITE, |
| 52 FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_NEW, | 52 FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_NEW, |
| 53 FILE_ATTRIBUTE_NORMAL, nullptr)); | 53 FILE_ATTRIBUTE_NORMAL, nullptr)); |
| 54 if (!file_handle.IsValid()) | 54 if (!file_handle.IsValid()) |
| 55 return false; | 55 return false; |
| 56 | 56 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 auto it = parameters.find("product"); | 139 auto it = parameters.find("product"); |
| 140 ASSERT_NE(parameters.end(), it); | 140 ASSERT_NE(parameters.end(), it); |
| 141 ASSERT_EQ(kExpectedProductName, it->second); | 141 ASSERT_EQ(kExpectedProductName, it->second); |
| 142 | 142 |
| 143 it = parameters.find("version"); | 143 it = parameters.find("version"); |
| 144 ASSERT_NE(parameters.end(), it); | 144 ASSERT_NE(parameters.end(), it); |
| 145 ASSERT_EQ(kVersion, it->second); | 145 ASSERT_EQ(kVersion, it->second); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace browser_watcher | 148 } // namespace browser_watcher |
| OLD | NEW |