Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: chrome/browser/ui/autofill/popup_view_common_unittest.cc

Issue 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/autofill/popup_view_common.cc ('k') | chrome/browser/ui/ime/ime_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/autofill/popup_view_common.h" 5 #include "chrome/browser/ui/autofill/popup_view_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ui/gfx/display.h" 14 #include "ui/display/display.h"
15 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
16 16
17 namespace autofill { 17 namespace autofill {
18 18
19 namespace { 19 namespace {
20 20
21 // Test class which overrides specific behavior for testing. 21 // Test class which overrides specific behavior for testing.
22 class TestPopupViewCommon : public PopupViewCommon { 22 class TestPopupViewCommon : public PopupViewCommon {
23 public: 23 public:
24 explicit TestPopupViewCommon(const gfx::Display& display) 24 explicit TestPopupViewCommon(const display::Display& display)
25 : display_(display) {} 25 : display_(display) {}
26 26
27 gfx::Display GetDisplayNearestPoint(const gfx::Point& point, 27 display::Display GetDisplayNearestPoint(
28 gfx::NativeView container_view) override { 28 const gfx::Point& point,
29 gfx::NativeView container_view) override {
29 return display_; 30 return display_;
30 } 31 }
31 32
32 private: 33 private:
33 gfx::Display display_; 34 display::Display display_;
34 }; 35 };
35 36
36 } // namespace 37 } // namespace
37 38
38 class PopupViewCommonTest : public ChromeRenderViewHostTestHarness { 39 class PopupViewCommonTest : public ChromeRenderViewHostTestHarness {
39 public: 40 public:
40 PopupViewCommonTest() {} 41 PopupViewCommonTest() {}
41 ~PopupViewCommonTest() override {} 42 ~PopupViewCommonTest() override {}
42 43
43 private: 44 private:
44 DISALLOW_COPY_AND_ASSIGN(PopupViewCommonTest); 45 DISALLOW_COPY_AND_ASSIGN(PopupViewCommonTest);
45 }; 46 };
46 47
47 TEST_F(PopupViewCommonTest, CalculatePopupBounds) { 48 TEST_F(PopupViewCommonTest, CalculatePopupBounds) {
48 int desired_width = 40; 49 int desired_width = 40;
49 int desired_height = 16; 50 int desired_height = 16;
50 51
51 // Set up the visible screen space. 52 // Set up the visible screen space.
52 gfx::Display display(0, 53 display::Display display(
53 gfx::Rect(0, 0, 2 * desired_width, 2 * desired_height)); 54 0, gfx::Rect(0, 0, 2 * desired_width, 2 * desired_height));
54 TestPopupViewCommon view_common(display); 55 TestPopupViewCommon view_common(display);
55 56
56 struct { 57 struct {
57 gfx::Rect element_bounds; 58 gfx::Rect element_bounds;
58 gfx::Rect expected_popup_bounds_ltr; 59 gfx::Rect expected_popup_bounds_ltr;
59 // Non-empty only when it differs from the ltr expectation. 60 // Non-empty only when it differs from the ltr expectation.
60 gfx::Rect expected_popup_bounds_rtl; 61 gfx::Rect expected_popup_bounds_rtl;
61 } test_cases[] = { 62 } test_cases[] = {
62 // The popup grows down and to the end. 63 // The popup grows down and to the end.
63 {gfx::Rect(38, 0, 5, 0), gfx::Rect(38, 0, desired_width, desired_height), 64 {gfx::Rect(38, 0, 5, 0), gfx::Rect(38, 0, desired_width, desired_height),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 web_contents()->GetNativeView(), /* is_rtl= */ true); 101 web_contents()->GetNativeView(), /* is_rtl= */ true);
101 gfx::Rect expected_popup_bounds = test_cases[i].expected_popup_bounds_rtl; 102 gfx::Rect expected_popup_bounds = test_cases[i].expected_popup_bounds_rtl;
102 if (expected_popup_bounds.IsEmpty()) 103 if (expected_popup_bounds.IsEmpty())
103 expected_popup_bounds = test_cases[i].expected_popup_bounds_ltr; 104 expected_popup_bounds = test_cases[i].expected_popup_bounds_ltr;
104 EXPECT_EQ(expected_popup_bounds.ToString(), actual_popup_bounds.ToString()) 105 EXPECT_EQ(expected_popup_bounds.ToString(), actual_popup_bounds.ToString())
105 << "Popup bounds failed to match for rtl test " << i; 106 << "Popup bounds failed to match for rtl test " << i;
106 } 107 }
107 } 108 }
108 109
109 } // namespace autofill 110 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/popup_view_common.cc ('k') | chrome/browser/ui/ime/ime_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698