From b462c19db193edb64071f0043a8b2cc36d9537e7 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 14 Nov 2016 13:47:31 -0500 Subject: [PATCH] Remove usage of gfx in unit tests (issue #1632) --- BUILD.gn | 2 ++ tests/unittests/os_rendering_unittest.cc | 13 +++---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index fa87642ee..7ce2df0d5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1341,6 +1341,8 @@ if (is_mac) { cef_unittests_sources = [ "tests/cefclient/browser/client_app_browser.cc", "tests/cefclient/browser/client_app_browser.h", + "tests/cefclient/browser/geometry_util.cc", + "tests/cefclient/browser/geometry_util.h", "tests/cefclient/browser/main_message_loop.cc", "tests/cefclient/browser/main_message_loop.h", "tests/cefclient/browser/main_message_loop_external_pump.cc", diff --git a/tests/unittests/os_rendering_unittest.cc b/tests/unittests/os_rendering_unittest.cc index 6f088da39..cec7f9c8a 100644 --- a/tests/unittests/os_rendering_unittest.cc +++ b/tests/unittests/os_rendering_unittest.cc @@ -4,14 +4,13 @@ #include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_code_conversion.h" -#include "ui/gfx/geometry/dip_util.h" -#include "ui/gfx/geometry/rect.h" #include "include/base/cef_bind.h" #include "include/base/cef_logging.h" #include "include/cef_v8.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_stream_resource_handler.h" +#include "tests/cefclient/browser/geometry_util.h" #include "tests/cefclient/browser/resource_util.h" #include "tests/unittests/routing_test_handler.h" @@ -1063,17 +1062,11 @@ class OSRTestHandler : public RoutingTestHandler, } CefRect GetScaledRect(const CefRect& rect) const { - const gfx::Rect& gfx_rect = gfx::ConvertRectToPixel( - scale_factor_, - gfx::Rect(rect.x, rect.y, rect.width, rect.height)); - return CefRect(gfx_rect.x(), gfx_rect.y(), - gfx_rect.width(), gfx_rect.height()); + return client::LogicalToDevice(rect, scale_factor_); } int GetScaledInt(int value) const { - const gfx::Point& gfx_point = gfx::ConvertPointToPixel( - scale_factor_, gfx::Point(value, 0)); - return gfx_point.x(); + return client::LogicalToDevice(value, scale_factor_); } CefRect GetExpectedRect(int index) {