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

Side by Side Diff: snapshot/win/pe_image_reader_test.cc

Issue 1326443007: win: Fix incorrect thread suspend count due to ScopedProcessSuspend (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: assert some threads captured Created 5 years, 3 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 | « snapshot/win/pe_image_annotations_reader_test.cc ('k') | snapshot/win/process_reader_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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 10 matching lines...) Expand all
21 21
22 extern "C" IMAGE_DOS_HEADER __ImageBase; 22 extern "C" IMAGE_DOS_HEADER __ImageBase;
23 23
24 namespace crashpad { 24 namespace crashpad {
25 namespace test { 25 namespace test {
26 namespace { 26 namespace {
27 27
28 TEST(PEImageReader, DebugDirectory) { 28 TEST(PEImageReader, DebugDirectory) {
29 PEImageReader pe_image_reader; 29 PEImageReader pe_image_reader;
30 ProcessReaderWin process_reader; 30 ProcessReaderWin process_reader;
31 ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess())); 31 ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess(),
32 ProcessSuspensionState::kRunning));
32 HMODULE self = reinterpret_cast<HMODULE>(&__ImageBase); 33 HMODULE self = reinterpret_cast<HMODULE>(&__ImageBase);
33 MODULEINFO module_info; 34 MODULEINFO module_info;
34 ASSERT_TRUE(GetModuleInformation( 35 ASSERT_TRUE(GetModuleInformation(
35 GetCurrentProcess(), self, &module_info, sizeof(module_info))); 36 GetCurrentProcess(), self, &module_info, sizeof(module_info)));
36 EXPECT_EQ(self, module_info.lpBaseOfDll); 37 EXPECT_EQ(self, module_info.lpBaseOfDll);
37 EXPECT_TRUE(pe_image_reader.Initialize(&process_reader, 38 EXPECT_TRUE(pe_image_reader.Initialize(&process_reader,
38 reinterpret_cast<WinVMAddress>(self), 39 reinterpret_cast<WinVMAddress>(self),
39 module_info.SizeOfImage, 40 module_info.SizeOfImage,
40 "self")); 41 "self"));
41 UUID uuid; 42 UUID uuid;
42 DWORD age; 43 DWORD age;
43 std::string pdbname; 44 std::string pdbname;
44 EXPECT_TRUE(pe_image_reader.DebugDirectoryInformation(&uuid, &age, &pdbname)); 45 EXPECT_TRUE(pe_image_reader.DebugDirectoryInformation(&uuid, &age, &pdbname));
45 EXPECT_NE(std::string::npos, pdbname.find("crashpad_snapshot_test")); 46 EXPECT_NE(std::string::npos, pdbname.find("crashpad_snapshot_test"));
46 const std::string suffix(".pdb"); 47 const std::string suffix(".pdb");
47 EXPECT_EQ( 48 EXPECT_EQ(
48 0, 49 0,
49 pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix)); 50 pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix));
50 } 51 }
51 52
52 } // namespace 53 } // namespace
53 } // namespace test 54 } // namespace test
54 } // namespace crashpad 55 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/win/pe_image_annotations_reader_test.cc ('k') | snapshot/win/process_reader_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698