1 : // Copyright 2012 Google Inc.
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 : #ifndef SYZYGY_PE_UNITTEST_UTIL_H_
16 : #define SYZYGY_PE_UNITTEST_UTIL_H_
17 :
18 : #include <windows.h>
19 :
20 : #include "base/file_path.h"
21 : #include "base/file_util.h"
22 : #include "gtest/gtest.h"
23 : #include "syzygy/common/unittest_util.h"
24 :
25 m : namespace testing {
26 :
27 m : class PELibUnitTest : public testing::ApplicationTestBase {
28 m : public:
29 : // Name of the test DLL and PDB.
30 m : static const wchar_t kDllName[];
31 m : static const wchar_t kDllPdbName[];
32 :
33 : // Name of the various test DLLs generated by the test_data project.
34 : // These are placed in $(OutputDir)\test_data, so use
35 : // GetExeTestDataRelativePath to build paths to them.
36 m : static const wchar_t kRandomizedTestDllName[];
37 m : static const wchar_t kRandomizedTestDllPdbName[];
38 m : static const wchar_t kRpcInstrumentedDllName[];
39 m : static const wchar_t kRpcInstrumentedDllPdbName[];
40 :
41 : // Cleans up after each test invocation.
42 m : virtual void TearDown() OVERRIDE;
43 :
44 : // Creates a temporary directory, which is cleaned up after the test runs.
45 m : void CreateTemporaryDir(FilePath* temp_dir);
46 :
47 : // Performs a series of assertations on the test DLL's integrity.
48 m : static void CheckTestDll(const FilePath& path);
49 :
50 m : private:
51 m : typedef testing::Test Super;
52 m : typedef std::vector<const FilePath> DirList;
53 :
54 : // List of temporary directorys created during this test invocation.
55 m : DirList temp_dirs_;
56 m : };
57 :
58 m : } // namespace testing
59 :
60 : #endif // SYZYGY_PE_UNITTEST_UTIL_H_
|