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

Side by Side Diff: minidump/minidump_crashpad_info_writer_test.cc

Issue 902793003: win: potentially uninitialized variables in minidump_crashpad_info_writer_test.cc (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_test-14
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 TEST(MinidumpCrashpadInfoWriter, Empty) { 55 TEST(MinidumpCrashpadInfoWriter, Empty) {
56 MinidumpFileWriter minidump_file_writer; 56 MinidumpFileWriter minidump_file_writer;
57 auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); 57 auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
58 EXPECT_FALSE(crashpad_info_writer->IsUseful()); 58 EXPECT_FALSE(crashpad_info_writer->IsUseful());
59 59
60 minidump_file_writer.AddStream(crashpad_info_writer.Pass()); 60 minidump_file_writer.AddStream(crashpad_info_writer.Pass());
61 61
62 StringFileWriter file_writer; 62 StringFileWriter file_writer;
63 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 63 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
64 64
65 const MinidumpCrashpadInfo* crashpad_info; 65 const MinidumpCrashpadInfo* crashpad_info = nullptr;
66 const MinidumpModuleCrashpadInfoList* module_list; 66 const MinidumpModuleCrashpadInfoList* module_list = nullptr;
67 67
68 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream( 68 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
69 file_writer.string(), &crashpad_info, &module_list)); 69 file_writer.string(), &crashpad_info, &module_list));
70 70
71 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version); 71 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
72 EXPECT_FALSE(module_list); 72 EXPECT_FALSE(module_list);
73 } 73 }
74 74
75 TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) { 75 TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
76 const uint32_t kMinidumpModuleListIndex = 3; 76 const uint32_t kMinidumpModuleListIndex = 3;
77 77
78 MinidumpFileWriter minidump_file_writer; 78 MinidumpFileWriter minidump_file_writer;
79 auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); 79 auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
80 80
81 auto module_list_writer = 81 auto module_list_writer =
82 make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); 82 make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
83 auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); 83 auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
84 module_writer->SetMinidumpModuleListIndex(kMinidumpModuleListIndex); 84 module_writer->SetMinidumpModuleListIndex(kMinidumpModuleListIndex);
85 module_list_writer->AddModule(module_writer.Pass()); 85 module_list_writer->AddModule(module_writer.Pass());
86 crashpad_info_writer->SetModuleList(module_list_writer.Pass()); 86 crashpad_info_writer->SetModuleList(module_list_writer.Pass());
87 87
88 EXPECT_TRUE(crashpad_info_writer->IsUseful()); 88 EXPECT_TRUE(crashpad_info_writer->IsUseful());
89 89
90 minidump_file_writer.AddStream(crashpad_info_writer.Pass()); 90 minidump_file_writer.AddStream(crashpad_info_writer.Pass());
91 91
92 StringFileWriter file_writer; 92 StringFileWriter file_writer;
93 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 93 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
94 94
95 const MinidumpCrashpadInfo* crashpad_info; 95 const MinidumpCrashpadInfo* crashpad_info = nullptr;
96 const MinidumpModuleCrashpadInfoList* module_list; 96 const MinidumpModuleCrashpadInfoList* module_list;
97 97
98 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream( 98 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
99 file_writer.string(), &crashpad_info, &module_list)); 99 file_writer.string(), &crashpad_info, &module_list));
100 100
101 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version); 101 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, crashpad_info->version);
102 ASSERT_TRUE(module_list); 102 ASSERT_TRUE(module_list);
103 ASSERT_EQ(1u, module_list->count); 103 ASSERT_EQ(1u, module_list->count);
104 104
105 const MinidumpModuleCrashpadInfo* module = 105 const MinidumpModuleCrashpadInfo* module =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 info_writer.reset(new MinidumpCrashpadInfoWriter()); 140 info_writer.reset(new MinidumpCrashpadInfoWriter());
141 info_writer->InitializeFromSnapshot(process_snapshot.get()); 141 info_writer->InitializeFromSnapshot(process_snapshot.get());
142 EXPECT_TRUE(info_writer->IsUseful()); 142 EXPECT_TRUE(info_writer->IsUseful());
143 143
144 MinidumpFileWriter minidump_file_writer; 144 MinidumpFileWriter minidump_file_writer;
145 minidump_file_writer.AddStream(info_writer.Pass()); 145 minidump_file_writer.AddStream(info_writer.Pass());
146 146
147 StringFileWriter file_writer; 147 StringFileWriter file_writer;
148 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 148 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
149 149
150 const MinidumpCrashpadInfo* info; 150 const MinidumpCrashpadInfo* info = nullptr;
151 const MinidumpModuleCrashpadInfoList* module_list; 151 const MinidumpModuleCrashpadInfoList* module_list;
152 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream( 152 ASSERT_NO_FATAL_FAILURE(GetCrashpadInfoStream(
153 file_writer.string(), &info, &module_list)); 153 file_writer.string(), &info, &module_list));
154 154
155 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, info->version); 155 EXPECT_EQ(MinidumpCrashpadInfo::kVersion, info->version);
156 ASSERT_TRUE(module_list); 156 ASSERT_TRUE(module_list);
157 ASSERT_EQ(1u, module_list->count); 157 ASSERT_EQ(1u, module_list->count);
158 158
159 const MinidumpModuleCrashpadInfo* module = 159 const MinidumpModuleCrashpadInfo* module =
160 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>( 160 MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfo>(
(...skipping 15 matching lines...) Expand all
176 176
177 const MinidumpSimpleStringDictionary* simple_annotations = 177 const MinidumpSimpleStringDictionary* simple_annotations =
178 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>( 178 MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>(
179 file_writer.string(), module->simple_annotations); 179 file_writer.string(), module->simple_annotations);
180 EXPECT_FALSE(simple_annotations); 180 EXPECT_FALSE(simple_annotations);
181 } 181 }
182 182
183 } // namespace 183 } // namespace
184 } // namespace test 184 } // namespace test
185 } // namespace crashpad 185 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698