Commit 140fe1bf authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Enable DPI awareness in unittest

The browser process is DPI aware.

To be able to detect correctly the configuration on my win10 computer,
I needed to add the code of this CL.

To make the tests fails, I needed to change the system config to
increase it to 125%, then I needed to sign-out and sign-in.

see the output:

../../chrome/browser/ui/views/layout_provider_unittest.cc(70): error: Expected equality of these values:
  system_dpi_scale
    Which is: 1.25
  1.0
    Which is: 1
The test requires default display settings. The DPI of the display is not 100%. dpi_scale=1.25
Stack trace:
Backtrace:
        base::debug::StackTrace::StackTrace [0x00007FFB86ADC648+40] (C:\src\chromium\src\base\debug\stack_trace.cc:203)
        StackTraceGetter::CurrentStackTrace [0x00007FF66C1DB986+86] (C:\src\chromium\src\third_party\googletest\custom\gtest\internal\custom\stack_trace_getter.cc:24)
        testing::internal::UnitTestImpl::CurrentOsStackTraceExceptTop [0x00007FF66C1F172A+90] (C:\src\chromium\src\third_party\googletest\src\googletest\src\gtest.cc:827)
        testing::internal::AssertHelper::operator= [0x00007FF66C1F11F7+87] (C:\src\chromium\src\third_party\googletest\src\googletest\src\gtest.cc:404)
        LayoutProviderTest::SetUpTestSuite [0x00007FF66B9EA76D+1117] (C:\src\chromium\src\chrome\browser\ui\views\layout_provider_unittest.cc:70)
R=tapted@chromium.org
Bug: 963868

Change-Id: Ifcda84cbea88c42e9d3b2c5c81c024a1a9abc371
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630978
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665182}
parent e1b0d632
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/win_util.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "ui/display/win/dpi.h" #include "ui/display/win/dpi.h"
#include "ui/gfx/system_fonts_win.h" #include "ui/gfx/system_fonts_win.h"
...@@ -49,6 +50,7 @@ class LayoutProviderTest : public testing::Test { ...@@ -49,6 +50,7 @@ class LayoutProviderTest : public testing::Test {
protected: protected:
static void SetUpTestSuite() { static void SetUpTestSuite() {
#if defined(OS_WIN) #if defined(OS_WIN)
base::win::EnableHighDPISupport();
gfx::win::InitializeDirectWrite(); gfx::win::InitializeDirectWrite();
// Ensures anti-aliasing is activated. // Ensures anti-aliasing is activated.
......
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