OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "base/win/base_features.h" |
9 #include "base/win/current_module.h" | 10 #include "base/win/current_module.h" |
10 #include "base/win/scoped_handle.h" | 11 #include "base/win/scoped_handle.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 namespace win { | 14 namespace win { |
14 namespace testing { | 15 namespace testing { |
15 | 16 |
16 extern "C" bool __declspec(dllexport) RunTest(); | 17 extern "C" bool __declspec(dllexport) RunTest(); |
17 | 18 |
18 namespace { | 19 namespace { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (!verifier_module) | 93 if (!verifier_module) |
93 return false; | 94 return false; |
94 | 95 |
95 // Get my module | 96 // Get my module |
96 HMODULE my_module = CURRENT_MODULE(); | 97 HMODULE my_module = CURRENT_MODULE(); |
97 if (!my_module) | 98 if (!my_module) |
98 return false; | 99 return false; |
99 | 100 |
100 HMODULE main_module = ::GetModuleHandle(NULL); | 101 HMODULE main_module = ::GetModuleHandle(NULL); |
101 | 102 |
102 #if defined(COMPONENT_BUILD) | 103 #if BUILDFLAG(SINGLE_MODULE_MODE_HANDLE_VERIFIER) |
103 // In a component build ActiveVerifier will always be created inside base.dll | 104 // In a component build ActiveVerifier will always be created inside base.dll |
104 // as the code always lives there. | 105 // as the code always lives there. |
105 if (verifier_module == my_module || verifier_module == main_module) | 106 if (verifier_module == my_module || verifier_module == main_module) |
106 return false; | 107 return false; |
107 #else | 108 #else |
108 // In a non-component build, ActiveVerifier should always be created in the | 109 // In a non-component build, ActiveVerifier should always be created in the |
109 // version of base linked with the main executable. | 110 // version of base linked with the main executable. |
110 if (verifier_module == my_module || verifier_module != main_module) | 111 if (verifier_module == my_module || verifier_module != main_module) |
111 return false; | 112 return false; |
112 #endif | 113 #endif |
113 return true; | 114 return true; |
114 } | 115 } |
115 | 116 |
116 } // namespace | 117 } // namespace |
117 | 118 |
118 bool RunTest() { | 119 bool RunTest() { |
119 return InternalRunThreadTest() && InternalRunLocationTest(); | 120 return InternalRunThreadTest() && InternalRunLocationTest(); |
120 } | 121 } |
121 | 122 |
122 } // testing | 123 } // testing |
123 } // win | 124 } // win |
124 } // base | 125 } // base |
OLD | NEW |