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" | |
10 #include "base/win/current_module.h" | 9 #include "base/win/current_module.h" |
11 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
12 | 11 |
13 namespace base { | 12 namespace base { |
14 namespace win { | 13 namespace win { |
15 namespace testing { | 14 namespace testing { |
16 | 15 |
17 extern "C" bool __declspec(dllexport) RunTest(); | 16 extern "C" bool __declspec(dllexport) RunTest(); |
18 | 17 |
19 namespace { | 18 namespace { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (!verifier_module) | 92 if (!verifier_module) |
94 return false; | 93 return false; |
95 | 94 |
96 // Get my module | 95 // Get my module |
97 HMODULE my_module = CURRENT_MODULE(); | 96 HMODULE my_module = CURRENT_MODULE(); |
98 if (!my_module) | 97 if (!my_module) |
99 return false; | 98 return false; |
100 | 99 |
101 HMODULE main_module = ::GetModuleHandle(NULL); | 100 HMODULE main_module = ::GetModuleHandle(NULL); |
102 | 101 |
103 #if BUILDFLAG(SINGLE_MODULE_MODE_HANDLE_VERIFIER) | 102 #if defined(COMPONENT_BUILD) |
104 // In a component build ActiveVerifier will always be created inside base.dll | 103 // In a component build ActiveVerifier will always be created inside base.dll |
105 // as the code always lives there. | 104 // as the code always lives there. |
106 if (verifier_module == my_module || verifier_module == main_module) | 105 if (verifier_module == my_module || verifier_module == main_module) |
107 return false; | 106 return false; |
108 #else | 107 #else |
109 // In a non-component build, ActiveVerifier should always be created in the | 108 // In a non-component build, ActiveVerifier should always be created in the |
110 // version of base linked with the main executable. | 109 // version of base linked with the main executable. |
111 if (verifier_module == my_module || verifier_module != main_module) | 110 if (verifier_module == my_module || verifier_module != main_module) |
112 return false; | 111 return false; |
113 #endif | 112 #endif |
114 return true; | 113 return true; |
115 } | 114 } |
116 | 115 |
117 } // namespace | 116 } // namespace |
118 | 117 |
119 bool RunTest() { | 118 bool RunTest() { |
120 return InternalRunThreadTest() && InternalRunLocationTest(); | 119 return InternalRunThreadTest() && InternalRunLocationTest(); |
121 } | 120 } |
122 | 121 |
123 } // testing | 122 } // testing |
124 } // win | 123 } // win |
125 } // base | 124 } // base |
OLD | NEW |