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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 686513004: Creating default implementation for aura::client::ScreenPositionClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 1 -> 1.0f Created 6 years, 1 month 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 | « athena/screen/screen_manager_impl.cc ('k') | ui/views/corewm/tooltip_controller_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "ui/aura/window_event_dispatcher.h" 49 #include "ui/aura/window_event_dispatcher.h"
50 #include "ui/aura/window_observer.h" 50 #include "ui/aura/window_observer.h"
51 #include "ui/base/ui_base_types.h" 51 #include "ui/base/ui_base_types.h"
52 #include "ui/compositor/compositor.h" 52 #include "ui/compositor/compositor.h"
53 #include "ui/compositor/test/draw_waiter_for_test.h" 53 #include "ui/compositor/test/draw_waiter_for_test.h"
54 #include "ui/events/event.h" 54 #include "ui/events/event.h"
55 #include "ui/events/event_utils.h" 55 #include "ui/events/event_utils.h"
56 #include "ui/events/gesture_detection/gesture_configuration.h" 56 #include "ui/events/gesture_detection/gesture_configuration.h"
57 #include "ui/events/test/event_generator.h" 57 #include "ui/events/test/event_generator.h"
58 #include "ui/wm/core/default_activation_client.h" 58 #include "ui/wm/core/default_activation_client.h"
59 #include "ui/wm/core/default_screen_position_client.h"
59 #include "ui/wm/core/window_util.h" 60 #include "ui/wm/core/window_util.h"
60 61
61 using testing::_; 62 using testing::_;
62 63
63 using blink::WebGestureEvent; 64 using blink::WebGestureEvent;
64 using blink::WebInputEvent; 65 using blink::WebInputEvent;
65 using blink::WebMouseEvent; 66 using blink::WebMouseEvent;
66 using blink::WebMouseWheelEvent; 67 using blink::WebMouseWheelEvent;
67 using blink::WebTouchEvent; 68 using blink::WebTouchEvent;
68 using blink::WebTouchPoint; 69 using blink::WebTouchPoint;
69 70
70 namespace content { 71 namespace content {
71 namespace { 72 namespace {
72 73
73 // Simple screen position client to test coordinate system conversion.
74 class TestScreenPositionClient
75 : public aura::client::ScreenPositionClient {
76 public:
77 TestScreenPositionClient() {}
78 ~TestScreenPositionClient() override {}
79
80 // aura::client::ScreenPositionClient overrides:
81 void ConvertPointToScreen(const aura::Window* window,
82 gfx::Point* point) override {
83 point->Offset(-1, -1);
84 }
85
86 void ConvertPointFromScreen(const aura::Window* window,
87 gfx::Point* point) override {
88 point->Offset(1, 1);
89 }
90
91 void ConvertHostPointToScreen(aura::Window* window,
92 gfx::Point* point) override {
93 ConvertPointToScreen(window, point);
94 }
95
96 void SetBounds(aura::Window* window,
97 const gfx::Rect& bounds,
98 const gfx::Display& display) override {}
99 };
100
101 class TestOverscrollDelegate : public OverscrollControllerDelegate { 74 class TestOverscrollDelegate : public OverscrollControllerDelegate {
102 public: 75 public:
103 explicit TestOverscrollDelegate(RenderWidgetHostView* view) 76 explicit TestOverscrollDelegate(RenderWidgetHostView* view)
104 : view_(view), 77 : view_(view),
105 current_mode_(OVERSCROLL_NONE), 78 current_mode_(OVERSCROLL_NONE),
106 completed_mode_(OVERSCROLL_NONE), 79 completed_mode_(OVERSCROLL_NONE),
107 delta_x_(0.f), 80 delta_x_(0.f),
108 delta_y_(0.f) {} 81 delta_y_(0.f) {}
109 82
110 ~TestOverscrollDelegate() override {} 83 ~TestOverscrollDelegate() override {}
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 EXPECT_TRUE(window->HasFocus()); 672 EXPECT_TRUE(window->HasFocus());
700 673
701 // Check that we'll also say it's okay to activate the window when there's an 674 // Check that we'll also say it's okay to activate the window when there's an
702 // ActivationClient defined. 675 // ActivationClient defined.
703 EXPECT_TRUE(view_->ShouldActivate()); 676 EXPECT_TRUE(view_->ShouldActivate());
704 } 677 }
705 678
706 // Checks that a popup is positioned correctly relative to its parent using 679 // Checks that a popup is positioned correctly relative to its parent using
707 // screen coordinates. 680 // screen coordinates.
708 TEST_F(RenderWidgetHostViewAuraTest, PositionChildPopup) { 681 TEST_F(RenderWidgetHostViewAuraTest, PositionChildPopup) {
709 TestScreenPositionClient screen_position_client; 682 wm::DefaultScreenPositionClient screen_position_client;
710 683
711 aura::Window* window = parent_view_->GetNativeView(); 684 aura::Window* window = parent_view_->GetNativeView();
712 aura::Window* root = window->GetRootWindow(); 685 aura::Window* root = window->GetRootWindow();
713 aura::client::SetScreenPositionClient(root, &screen_position_client); 686 aura::client::SetScreenPositionClient(root, &screen_position_client);
714 687
715 parent_view_->SetBounds(gfx::Rect(10, 10, 800, 600)); 688 parent_view_->SetBounds(gfx::Rect(10, 10, 800, 600));
716 gfx::Rect bounds_in_screen = parent_view_->GetViewBounds(); 689 gfx::Rect bounds_in_screen = parent_view_->GetViewBounds();
717 int horiz = bounds_in_screen.width() / 4; 690 int horiz = bounds_in_screen.width() / 4;
718 int vert = bounds_in_screen.height() / 4; 691 int vert = bounds_in_screen.height() / 4;
719 bounds_in_screen.Inset(horiz, vert); 692 bounds_in_screen.Inset(horiz, vert);
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 } 2907 }
2935 2908
2936 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 2909 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted
2937 // before RWH), we clean up properly and don't leak the RWHVGuest. 2910 // before RWH), we clean up properly and don't leak the RWHVGuest.
2938 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 2911 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
2939 TearDownEnvironment(); 2912 TearDownEnvironment();
2940 ASSERT_FALSE(guest_view_weak_.get()); 2913 ASSERT_FALSE(guest_view_weak_.get());
2941 } 2914 }
2942 2915
2943 } // namespace content 2916 } // namespace content
OLDNEW
« no previous file with comments | « athena/screen/screen_manager_impl.cc ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698