1 : // Copyright 2012 Google Inc. 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 : // Central place to house common unittest functionality for pdb_lib.
16 :
17 : #ifndef SYZYGY_PDB_UNITTEST_UTIL_H_
18 : #define SYZYGY_PDB_UNITTEST_UTIL_H_
19 :
20 : #include "base/files/file_util.h"
21 : #include "syzygy/pdb/pdb_file.h"
22 : #include "syzygy/pdb/pdb_file_stream.h"
23 :
24 m : namespace testing {
25 :
26 : // Paths to various files.
27 m : extern const wchar_t kTestPdbFilePath[];
28 m : extern const wchar_t kTestDllFilePath[];
29 m : extern const wchar_t kOmappedTestPdbFilePath[];
30 m : extern const wchar_t kPdbStrPath[];
31 m : extern const wchar_t kValidPdbSymbolRecordStreamPath[];
32 m : extern const wchar_t kInvalidPdbSymbolRecordStreamPath[];
33 m : extern const wchar_t kValidPdbTypeInfoStreamPath[];
34 m : extern const wchar_t kInvalidHeaderPdbTypeInfoStreamPath[];
35 m : extern const wchar_t kInvalidDataPdbTypeInfoStreamPath[];
36 m : extern const wchar_t kValidPdbDbiStreamPath[];
37 m : extern const wchar_t kInvalidPdbDbiStreamPath[];
38 :
39 : // Get a PDB stream from a file.
40 m : scoped_refptr<pdb::PdbFileStream> GetStreamFromFile(base::FilePath file_path);
41 :
42 : // Initializes an empty PdbFile so that it looks like a valid PDB by creating
43 : // a valid PdbHeaderInfo stream. Contains gtest assertions, so is intended to be
44 : // used with ASSERT_NO_FATAL_FAILURE.
45 : // @param pdb_file The empty PdbFile to be initialized.
46 m : void InitMockPdbFile(pdb::PdbFile* pdb_file);
47 :
48 m : } // namespace testing
49 :
50 : #endif // SYZYGY_PDB_UNITTEST_UTIL_H_
|