Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16)

Delta Between Two Patch Sets: src/processor/minidump_processor_unittest.cc

Issue 5684002: Refactoring in preparation for microdump processing (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Left Patch Set: Revert mistakenly changed aclocal.m4 Created 10 years, 7 months ago
Right Patch Set: More alpha sorting fixes in Makefile.am Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/processor/minidump.cc ('k') | src/processor/postfix_evaluator_unittest.cc » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright (c) 2006, Google Inc. 1 // Copyright (c) 2006, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 MockMinidumpMemoryList() : MinidumpMemoryList(NULL) {} 86 MockMinidumpMemoryList() : MinidumpMemoryList(NULL) {}
87 87
88 MOCK_METHOD1(GetMemoryRegionForAddress, MinidumpMemoryRegion*(uint64_t)); 88 MOCK_METHOD1(GetMemoryRegionForAddress, MinidumpMemoryRegion*(uint64_t));
89 }; 89 };
90 90
91 class MockMinidumpThread : public MinidumpThread { 91 class MockMinidumpThread : public MinidumpThread {
92 public: 92 public:
93 MockMinidumpThread() : MinidumpThread(NULL) {} 93 MockMinidumpThread() : MinidumpThread(NULL) {}
94 94
95 MOCK_CONST_METHOD1(GetThreadID, bool(uint32_t*)); 95 MOCK_CONST_METHOD1(GetThreadID, bool(uint32_t*));
96 MOCK_METHOD0(GetContext, DumpContext*()); 96 MOCK_METHOD0(GetContext, MinidumpContext*());
97 MOCK_METHOD0(GetMemory, MinidumpMemoryRegion*()); 97 MOCK_METHOD0(GetMemory, MinidumpMemoryRegion*());
98 MOCK_CONST_METHOD0(GetStartOfStackMemoryRange, uint64_t()); 98 MOCK_CONST_METHOD0(GetStartOfStackMemoryRange, uint64_t());
99 }; 99 };
100 100
101 // This is crappy, but MinidumpProcessor really does want a 101 // This is crappy, but MinidumpProcessor really does want a
102 // MinidumpMemoryRegion. 102 // MinidumpMemoryRegion.
103 class MockMinidumpMemoryRegion : public MinidumpMemoryRegion { 103 class MockMinidumpMemoryRegion : public MinidumpMemoryRegion {
104 public: 104 public:
105 MockMinidumpMemoryRegion(uint64_t base, const string& contents) : 105 MockMinidumpMemoryRegion(uint64_t base, const string& contents) :
106 MinidumpMemoryRegion(NULL) { 106 MinidumpMemoryRegion(NULL) {
(...skipping 19 matching lines...) Expand all
126 MockMemoryRegion region_; 126 MockMemoryRegion region_;
127 }; 127 };
128 128
129 } // namespace google_breakpad 129 } // namespace google_breakpad
130 130
131 namespace { 131 namespace {
132 132
133 using google_breakpad::BasicSourceLineResolver; 133 using google_breakpad::BasicSourceLineResolver;
134 using google_breakpad::CallStack; 134 using google_breakpad::CallStack;
135 using google_breakpad::CodeModule; 135 using google_breakpad::CodeModule;
136 using google_breakpad::DumpContext; 136 using google_breakpad::MinidumpContext;
137 using google_breakpad::MinidumpMemoryRegion; 137 using google_breakpad::MinidumpMemoryRegion;
138 using google_breakpad::MinidumpProcessor; 138 using google_breakpad::MinidumpProcessor;
139 using google_breakpad::MinidumpSystemInfo; 139 using google_breakpad::MinidumpSystemInfo;
140 using google_breakpad::MinidumpThreadList; 140 using google_breakpad::MinidumpThreadList;
141 using google_breakpad::MinidumpThread; 141 using google_breakpad::MinidumpThread;
142 using google_breakpad::MockMinidump; 142 using google_breakpad::MockMinidump;
143 using google_breakpad::MockMinidumpMemoryList; 143 using google_breakpad::MockMinidumpMemoryList;
144 using google_breakpad::MockMinidumpMemoryRegion; 144 using google_breakpad::MockMinidumpMemoryRegion;
145 using google_breakpad::MockMinidumpThread; 145 using google_breakpad::MockMinidumpThread;
146 using google_breakpad::MockMinidumpThreadList; 146 using google_breakpad::MockMinidumpThreadList;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 explicit TestMinidumpSystemInfo(MDRawSystemInfo info) : 287 explicit TestMinidumpSystemInfo(MDRawSystemInfo info) :
288 MinidumpSystemInfo(NULL) { 288 MinidumpSystemInfo(NULL) {
289 valid_ = true; 289 valid_ = true;
290 system_info_ = info; 290 system_info_ = info;
291 csd_version_ = new string(""); 291 csd_version_ = new string("");
292 } 292 }
293 }; 293 };
294 294
295 // A test minidump context, just returns the MDRawContextX86 295 // A test minidump context, just returns the MDRawContextX86
296 // fed to it. 296 // fed to it.
297 class TestMinidumpContext : public DumpContext { 297 class TestMinidumpContext : public MinidumpContext {
298 public: 298 public:
299 explicit TestMinidumpContext(const MDRawContextX86& context) : 299 explicit TestMinidumpContext(const MDRawContextX86& context) :
300 DumpContext() { 300 MinidumpContext(NULL) {
301 valid_ = true; 301 valid_ = true;
302 SetContextX86(new MDRawContextX86(context)); 302 SetContextX86(new MDRawContextX86(context));
303 SetContextFlags(MD_CONTEXT_X86); 303 SetContextFlags(MD_CONTEXT_X86);
304 } 304 }
305 }; 305 };
306 306
307 class MinidumpProcessorTest : public ::testing::Test { 307 class MinidumpProcessorTest : public ::testing::Test {
308 }; 308 };
309 309
310 TEST_F(MinidumpProcessorTest, TestCorruptMinidumps) { 310 TEST_F(MinidumpProcessorTest, TestCorruptMinidumps) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 MockMinidumpMemoryList memory_list; 554 MockMinidumpMemoryList memory_list;
555 EXPECT_CALL(dump, GetMemoryList()). 555 EXPECT_CALL(dump, GetMemoryList()).
556 WillOnce(Return(&memory_list)); 556 WillOnce(Return(&memory_list));
557 557
558 // Return a thread missing a thread context. 558 // Return a thread missing a thread context.
559 MockMinidumpThread no_context_thread; 559 MockMinidumpThread no_context_thread;
560 EXPECT_CALL(no_context_thread, GetThreadID(_)). 560 EXPECT_CALL(no_context_thread, GetThreadID(_)).
561 WillRepeatedly(DoAll(SetArgumentPointee<0>(1), 561 WillRepeatedly(DoAll(SetArgumentPointee<0>(1),
562 Return(true))); 562 Return(true)));
563 EXPECT_CALL(no_context_thread, GetContext()). 563 EXPECT_CALL(no_context_thread, GetContext()).
564 WillRepeatedly(Return(reinterpret_cast<DumpContext*>(NULL))); 564 WillRepeatedly(Return(reinterpret_cast<MinidumpContext*>(NULL)));
565 565
566 // The memory contents don't really matter here, since it won't be used. 566 // The memory contents don't really matter here, since it won't be used.
567 MockMinidumpMemoryRegion no_context_thread_memory(0x1234, "xxx"); 567 MockMinidumpMemoryRegion no_context_thread_memory(0x1234, "xxx");
568 EXPECT_CALL(no_context_thread, GetMemory()). 568 EXPECT_CALL(no_context_thread, GetMemory()).
569 WillRepeatedly(Return(&no_context_thread_memory)); 569 WillRepeatedly(Return(&no_context_thread_memory));
570 EXPECT_CALL(no_context_thread, GetStartOfStackMemoryRange()). 570 EXPECT_CALL(no_context_thread, GetStartOfStackMemoryRange()).
571 Times(0); 571 Times(0);
572 EXPECT_CALL(memory_list, GetMemoryRegionForAddress(_)). 572 EXPECT_CALL(memory_list, GetMemoryRegionForAddress(_)).
573 Times(0); 573 Times(0);
574 574
(...skipping 11 matching lines...) Expand all
586 ASSERT_EQ(1U, state.threads()->size()); 586 ASSERT_EQ(1U, state.threads()->size());
587 ASSERT_EQ(0U, state.threads()->at(0)->frames()->size()); 587 ASSERT_EQ(0U, state.threads()->at(0)->frames()->size());
588 } 588 }
589 589
590 } // namespace 590 } // namespace
591 591
592 int main(int argc, char *argv[]) { 592 int main(int argc, char *argv[]) {
593 ::testing::InitGoogleTest(&argc, argv); 593 ::testing::InitGoogleTest(&argc, argv);
594 return RUN_ALL_TESTS(); 594 return RUN_ALL_TESTS();
595 } 595 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted