Commit f1006d00 authored by Cliff Smolinsky's avatar Cliff Smolinsky Committed by Commit Bot

Add PinUser32() to content_browsertests's main method

Calls to pin or load user32.dll cannot happen on the main thread loop
because they are blocking calls. The test code always executes on the
main thread loop, so if the test code hits anything that requires
user32 then it will crash (with dchecks on). To avoid this, we simply
call PinUser32() in main before we get to the main thread loop.
This same thing is done in browser_tests_main.cc and shell_main.cc for
other test binaries.

It's worth noting that the crash from this bug only hits on touch
devices where the IsDeviceUsedAsATablet method runs.

Bug: 968500
Change-Id: Ia3de38c7893b7143bde39aef3edc88ff0853caec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637503
Commit-Queue: Tommi <tommi@chromium.org>
Reviewed-by: default avatarTommi <tommi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665623}
parent 5c5cc7ff
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#include "ui/base/buildflags.h" #include "ui/base/buildflags.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
#include "base/win/win_util.h"
#endif // OS_WIN
namespace content { namespace content {
class ContentBrowserTestSuite : public ContentTestSuiteBase { class ContentBrowserTestSuite : public ContentTestSuiteBase {
...@@ -86,6 +90,11 @@ int main(int argc, char** argv) { ...@@ -86,6 +90,11 @@ int main(int argc, char** argv) {
if (parallel_jobs > 1U) { if (parallel_jobs > 1U) {
parallel_jobs /= 2U; parallel_jobs /= 2U;
} }
#if defined(OS_WIN)
// Load and pin user32.dll to avoid having to load it once tests start while
// on the main thread loop where blocking calls are disallowed.
base::win::PinUser32();
#endif // OS_WIN
content::ContentTestLauncherDelegate launcher_delegate; content::ContentTestLauncherDelegate launcher_delegate;
return LaunchTests(&launcher_delegate, parallel_jobs, argc, argv); return LaunchTests(&launcher_delegate, parallel_jobs, argc, argv);
} }
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