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

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

Issue 1311003003: Implement ModuleSnapshotWin::UUID (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . 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
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "snapshot/win/pe_image_reader.h"
16
17 #include <psapi.h>
18
19 #include "gtest/gtest.h"
20 #include "snapshot/win/process_reader_win.h"
21
22 extern "C" IMAGE_DOS_HEADER __ImageBase;
23
24 namespace crashpad {
25 namespace test {
26 namespace {
27
28 TEST(PEImageReader, DebugDirectory) {
29 PEImageReader pe_image_reader;
30 ProcessReaderWin process_reader;
31 ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess()));
32 HMODULE self = reinterpret_cast<HMODULE>(&__ImageBase);
33 MODULEINFO module_info;
34 ASSERT_TRUE(GetModuleInformation(
35 GetCurrentProcess(), self, &module_info, sizeof(module_info)));
36 EXPECT_EQ(module_info.lpBaseOfDll, self);
Mark Mentovai 2015/09/01 01:20:31 For the EXPECT_/ASSERT_ family, the arguments are
scottmg 2015/09/01 16:29:53 Done.
37 EXPECT_TRUE(pe_image_reader.Initialize(&process_reader,
38 reinterpret_cast<WinVMAddress>(self),
39 module_info.SizeOfImage,
40 "self"));
41 UUID uuid;
42 DWORD age;
43 std::string pdbname;
44 EXPECT_TRUE(pe_image_reader.DebugDirectoryInformation(&uuid, &age, &pdbname));
45 EXPECT_NE(pdbname.find("crashpad_snapshot_test"), -1);
46 const std::string suffix(".pdb");
47 EXPECT_EQ(
48 pdbname.compare(pdbname.size() - suffix.size(), suffix.size(), suffix),
49 0);
50 }
51
52 } // namespace
53 } // namespace test
54 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698