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

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

Issue 2259033003: New accessibility virtual keyboard behavior in non-sticky mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 4 years, 4 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 | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/test/BUILD.gn » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 #include "ui/aura/layout_manager.h" 68 #include "ui/aura/layout_manager.h"
69 #include "ui/aura/test/aura_test_helper.h" 69 #include "ui/aura/test/aura_test_helper.h"
70 #include "ui/aura/test/aura_test_utils.h" 70 #include "ui/aura/test/aura_test_utils.h"
71 #include "ui/aura/test/test_cursor_client.h" 71 #include "ui/aura/test/test_cursor_client.h"
72 #include "ui/aura/test/test_screen.h" 72 #include "ui/aura/test/test_screen.h"
73 #include "ui/aura/test/test_window_delegate.h" 73 #include "ui/aura/test/test_window_delegate.h"
74 #include "ui/aura/window.h" 74 #include "ui/aura/window.h"
75 #include "ui/aura/window_event_dispatcher.h" 75 #include "ui/aura/window_event_dispatcher.h"
76 #include "ui/aura/window_observer.h" 76 #include "ui/aura/window_observer.h"
77 #include "ui/base/clipboard/clipboard.h" 77 #include "ui/base/clipboard/clipboard.h"
78 #include "ui/base/ui_base_switches.h"
78 #include "ui/base/ui_base_types.h" 79 #include "ui/base/ui_base_types.h"
79 #include "ui/compositor/compositor.h" 80 #include "ui/compositor/compositor.h"
80 #include "ui/compositor/layer_tree_owner.h" 81 #include "ui/compositor/layer_tree_owner.h"
81 #include "ui/compositor/test/draw_waiter_for_test.h" 82 #include "ui/compositor/test/draw_waiter_for_test.h"
82 #include "ui/events/blink/blink_event_util.h" 83 #include "ui/events/blink/blink_event_util.h"
83 #include "ui/events/blink/web_input_event_traits.h" 84 #include "ui/events/blink/web_input_event_traits.h"
84 #include "ui/events/event.h" 85 #include "ui/events/event.h"
85 #include "ui/events/event_utils.h" 86 #include "ui/events/event_utils.h"
86 #include "ui/events/gesture_detection/gesture_configuration.h" 87 #include "ui/events/gesture_detection/gesture_configuration.h"
87 #include "ui/events/keycodes/dom/dom_code.h" 88 #include "ui/events/keycodes/dom/dom_code.h"
88 #include "ui/events/keycodes/dom/keycode_converter.h" 89 #include "ui/events/keycodes/dom/keycode_converter.h"
89 #include "ui/events/test/event_generator.h" 90 #include "ui/events/test/event_generator.h"
90 #include "ui/gfx/geometry/rect.h" 91 #include "ui/gfx/geometry/rect.h"
91 #include "ui/gfx/selection_bound.h" 92 #include "ui/gfx/selection_bound.h"
92 #include "ui/wm/core/default_activation_client.h" 93 #include "ui/wm/core/default_activation_client.h"
93 #include "ui/wm/core/default_screen_position_client.h" 94 #include "ui/wm/core/default_screen_position_client.h"
94 #include "ui/wm/core/window_util.h" 95 #include "ui/wm/core/window_util.h"
95 96
97 #if defined(OS_CHROMEOS)
98 #include "ui/base/ime/input_method.h"
99 #endif
100
96 using testing::_; 101 using testing::_;
97 102
98 using blink::WebGestureEvent; 103 using blink::WebGestureEvent;
99 using blink::WebInputEvent; 104 using blink::WebInputEvent;
100 using blink::WebMouseEvent; 105 using blink::WebMouseEvent;
101 using blink::WebMouseWheelEvent; 106 using blink::WebMouseWheelEvent;
102 using blink::WebTouchEvent; 107 using blink::WebTouchEvent;
103 using blink::WebTouchPoint; 108 using blink::WebTouchPoint;
104 using ui::WebInputEventTraits; 109 using ui::WebInputEventTraits;
105 110
(...skipping 3684 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); 3795 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode());
3791 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 3796 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
3792 3797
3793 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 3798 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
3794 blink::WebGestureDeviceTouchscreen); 3799 blink::WebGestureDeviceTouchscreen);
3795 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 3800 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
3796 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 3801 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
3797 EXPECT_EQ(3U, sink_->message_count()); 3802 EXPECT_EQ(3U, sink_->message_count());
3798 } 3803 }
3799 3804
3805 #if defined(OS_CHROMEOS)
3806 // Check that when accessibility virtual keyboard is enabled, windows are
3807 // shifted up when focused and restored when focus is lost.
3808 TEST_F(RenderWidgetHostViewAuraOverscrollTest,
3809 VirtualKeyboardFocusEnsureCaretInRect) {
3810 SetUpOverscrollEnvironment();
3811 // TODO (oshima): Test that overscroll occurs.
3812
3813 // Enable new virtual keyboard behavior.
3814 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
3815 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) {
3816 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior);
3817 }
3818
3819 aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow();
3820 ui::InputMethod* input_method = root_window->GetHost()->GetInputMethod();
3821 int keyboard_height = 200;
3822 gfx::Rect root_bounds = root_window->bounds();
3823 gfx::Rect root_bounds_with_keyboard = gfx::Rect(
3824 root_bounds.origin(),
3825 gfx::Size(root_bounds.width(), root_bounds.height() - keyboard_height));
3826 gfx::Rect orig_view_bounds = gfx::Rect(0, 300, 400, 200);
3827 gfx::Rect shifted_view_bounds = gfx::Rect(0, 200, 400, 200);
3828
3829 // Focus the window.
3830 view_->SetBounds(orig_view_bounds);
3831 input_method->SetFocusedTextInputClient(view_);
3832 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3833
3834 // Simulate virtual keyboard.
3835 input_method->SetAvailableBounds(root_bounds_with_keyboard);
3836
3837 // Window should be shifted.
3838 EXPECT_EQ(view_->GetNativeView()->bounds(), shifted_view_bounds);
3839
3840 // Change the focus.
3841 input_method->SetFocusedTextInputClient(nullptr);
3842
3843 // Window should be restored.
3844 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3845 }
3846 #endif
3847
3800 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 3848 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted
3801 // before RWH), we clean up properly and don't leak the RWHVGuest. 3849 // before RWH), we clean up properly and don't leak the RWHVGuest.
3802 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 3850 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
3803 view_->InitAsChild(nullptr); 3851 view_->InitAsChild(nullptr);
3804 TearDownEnvironment(); 3852 TearDownEnvironment();
3805 ASSERT_FALSE(guest_view_weak_.get()); 3853 ASSERT_FALSE(guest_view_weak_.get());
3806 } 3854 }
3807 3855
3808 // Tests that invalid touch events are consumed and handled 3856 // Tests that invalid touch events are consumed and handled
3809 // synchronously. 3857 // synchronously.
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 4618
4571 // Retrieve the selected text from clipboard and verify it is as expected. 4619 // Retrieve the selected text from clipboard and verify it is as expected.
4572 base::string16 result_text; 4620 base::string16 result_text;
4573 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4621 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4574 EXPECT_EQ(expected_text, result_text); 4622 EXPECT_EQ(expected_text, result_text);
4575 } 4623 }
4576 } 4624 }
4577 #endif 4625 #endif
4578 4626
4579 } // namespace content 4627 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698