Commit 56bc0bfb authored by Chris Davis's avatar Chris Davis Committed by Commit Bot

Fix delayloads_unittests for windows 7

Fix delayloads_unittests to properly handle is_multi_dll_chrome set to
false and when run on win7. A previous change to modify behavior based
on CHROME_MULTIPLE_DLL_BROWSER was not correct since is_multi_dll_chrome
was not checked in the tests BUILD.gn.  Also, Windows7 will load user32
due to static dependencies starting from oleaut32.dll which are not
present on windows 10.  Unfortunately oleaut32 is pulled in from many
dependencies during dll load of chrome (when merged) or chrome_child.

Change-Id: If364f08c35e6c881249b2be3ce092eb2ddd48a68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872563
Commit-Queue: Chris Davis <chrdavis@microsoft.com>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarCliff Smolinsky <cliffsmo@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#707996}
parent 189c6d83
......@@ -6592,6 +6592,12 @@ if (is_win) {
sources = [
"delayload/delayloads_unittest.cc",
]
defines = []
if (is_multi_dll_chrome) {
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}
include_dirs = [ "$target_gen_dir" ]
deps = [
"//base",
......
......@@ -170,8 +170,19 @@ TEST_F(DelayloadsTest, DISABLED_ChromeDllLoadSanityTestImpl) {
HMODULE chrome_module_handle = ::LoadLibrary(dll.value().c_str());
ASSERT_TRUE(chrome_module_handle != nullptr);
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
// Loading chrome.dll should not load user32.dll.
EXPECT_EQ(nullptr, ::GetModuleHandle(L"user32.dll"));
#else
// Loading chrome.dll should not load user32.dll on Win10.
// On Win7, chains of system dlls and lack of apisets result in it loading.
if (base::win::GetVersion() >= base::win::Version::WIN10) {
EXPECT_EQ(nullptr, ::GetModuleHandle(L"user32.dll"));
} else {
EXPECT_NE(nullptr, ::GetModuleHandle(L"user32.dll"));
}
#endif // CHROME_MULTIPLE_DLL_BROWSER
}
#if defined(CHROME_MULTIPLE_DLL_BROWSER)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment