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

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

Issue 2553603002: New accessibility virtual keyboard behavior in non-sticky mode. (Closed)
Patch Set: fix test crashes Created 4 years 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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "ui/aura/layout_manager.h" 69 #include "ui/aura/layout_manager.h"
70 #include "ui/aura/test/aura_test_helper.h" 70 #include "ui/aura/test/aura_test_helper.h"
71 #include "ui/aura/test/aura_test_utils.h" 71 #include "ui/aura/test/aura_test_utils.h"
72 #include "ui/aura/test/test_cursor_client.h" 72 #include "ui/aura/test/test_cursor_client.h"
73 #include "ui/aura/test/test_screen.h" 73 #include "ui/aura/test/test_screen.h"
74 #include "ui/aura/test/test_window_delegate.h" 74 #include "ui/aura/test/test_window_delegate.h"
75 #include "ui/aura/window.h" 75 #include "ui/aura/window.h"
76 #include "ui/aura/window_event_dispatcher.h" 76 #include "ui/aura/window_event_dispatcher.h"
77 #include "ui/aura/window_observer.h" 77 #include "ui/aura/window_observer.h"
78 #include "ui/base/clipboard/clipboard.h" 78 #include "ui/base/clipboard/clipboard.h"
79 #include "ui/base/ui_base_switches.h"
79 #include "ui/base/ui_base_types.h" 80 #include "ui/base/ui_base_types.h"
80 #include "ui/compositor/compositor.h" 81 #include "ui/compositor/compositor.h"
81 #include "ui/compositor/layer_tree_owner.h" 82 #include "ui/compositor/layer_tree_owner.h"
82 #include "ui/compositor/test/draw_waiter_for_test.h" 83 #include "ui/compositor/test/draw_waiter_for_test.h"
83 #include "ui/events/blink/blink_event_util.h" 84 #include "ui/events/blink/blink_event_util.h"
84 #include "ui/events/blink/web_input_event_traits.h" 85 #include "ui/events/blink/web_input_event_traits.h"
85 #include "ui/events/event.h" 86 #include "ui/events/event.h"
86 #include "ui/events/event_utils.h" 87 #include "ui/events/event_utils.h"
87 #include "ui/events/gesture_detection/gesture_configuration.h" 88 #include "ui/events/gesture_detection/gesture_configuration.h"
88 #include "ui/events/gestures/motion_event_aura.h" 89 #include "ui/events/gestures/motion_event_aura.h"
89 #include "ui/events/keycodes/dom/dom_code.h" 90 #include "ui/events/keycodes/dom/dom_code.h"
90 #include "ui/events/keycodes/dom/keycode_converter.h" 91 #include "ui/events/keycodes/dom/keycode_converter.h"
91 #include "ui/events/test/event_generator.h" 92 #include "ui/events/test/event_generator.h"
92 #include "ui/gfx/geometry/rect.h" 93 #include "ui/gfx/geometry/rect.h"
93 #include "ui/gfx/selection_bound.h" 94 #include "ui/gfx/selection_bound.h"
94 #include "ui/wm/core/default_activation_client.h" 95 #include "ui/wm/core/default_activation_client.h"
95 #include "ui/wm/core/default_screen_position_client.h" 96 #include "ui/wm/core/default_screen_position_client.h"
96 #include "ui/wm/core/window_util.h" 97 #include "ui/wm/core/window_util.h"
97 98
99 #if defined(OS_CHROMEOS)
100 #include "ui/base/ime/input_method.h"
101 #endif
102
98 using testing::_; 103 using testing::_;
99 104
100 using blink::WebGestureEvent; 105 using blink::WebGestureEvent;
101 using blink::WebInputEvent; 106 using blink::WebInputEvent;
102 using blink::WebMouseEvent; 107 using blink::WebMouseEvent;
103 using blink::WebMouseWheelEvent; 108 using blink::WebMouseWheelEvent;
104 using blink::WebTouchEvent; 109 using blink::WebTouchEvent;
105 using blink::WebTouchPoint; 110 using blink::WebTouchPoint;
106 using ui::WebInputEventTraits; 111 using ui::WebInputEventTraits;
107 112
(...skipping 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3898 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); 3903 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode());
3899 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 3904 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
3900 3905
3901 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 3906 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
3902 blink::WebGestureDeviceTouchscreen); 3907 blink::WebGestureDeviceTouchscreen);
3903 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 3908 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
3904 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 3909 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
3905 EXPECT_EQ(3U, sink_->message_count()); 3910 EXPECT_EQ(3U, sink_->message_count());
3906 } 3911 }
3907 3912
3913 #if defined(OS_CHROMEOS)
3914 // Check that when accessibility virtual keyboard is enabled, windows are
3915 // shifted up when focused and restored when focus is lost.
3916 TEST_F(RenderWidgetHostViewAuraOverscrollTest,
3917 VirtualKeyboardFocusEnsureCaretInRect) {
3918 SetUpOverscrollEnvironment();
3919 // TODO (oshima): Test that overscroll occurs.
3920
3921 // Enable new virtual keyboard behavior.
3922 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
3923 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) {
3924 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior);
3925 }
3926
3927 aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow();
3928 ui::InputMethod* input_method = root_window->GetHost()->GetInputMethod();
3929 int keyboard_height = 200;
3930 gfx::Rect root_bounds = root_window->bounds();
3931 gfx::Rect orig_view_bounds = gfx::Rect(0, 300, 400, 200);
3932 gfx::Rect shifted_view_bounds = gfx::Rect(0, 200, 400, 200);
3933 gfx::Rect keyboard_view_bounds =
3934 gfx::Rect(0, root_bounds.height() - keyboard_height, root_bounds.width(),
3935 keyboard_height);
3936
3937 // Focus the window.
3938 view_->SetBounds(orig_view_bounds);
3939 input_method->SetFocusedTextInputClient(view_);
3940 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3941
3942 // Simulate virtual keyboard.
3943 input_method->SetOnScreenKeyboardBounds(keyboard_view_bounds);
3944
3945 // Window should be shifted.
3946 EXPECT_EQ(view_->GetNativeView()->bounds(), shifted_view_bounds);
3947
3948 // Change the focus.
3949 input_method->SetFocusedTextInputClient(nullptr);
3950
3951 // Window should be restored.
3952 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3953 }
3954 #endif // defined(OS_CHROMEOS)
3955
3908 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 3956 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted
3909 // before RWH), we clean up properly and don't leak the RWHVGuest. 3957 // before RWH), we clean up properly and don't leak the RWHVGuest.
3910 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 3958 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
3911 view_->InitAsChild(nullptr); 3959 view_->InitAsChild(nullptr);
3912 TearDownEnvironment(); 3960 TearDownEnvironment();
3913 ASSERT_FALSE(guest_view_weak_.get()); 3961 ASSERT_FALSE(guest_view_weak_.get());
3914 } 3962 }
3915 3963
3916 // Tests that invalid touch events are consumed and handled 3964 // Tests that invalid touch events are consumed and handled
3917 // synchronously. 3965 // synchronously.
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 4724
4677 // Retrieve the selected text from clipboard and verify it is as expected. 4725 // Retrieve the selected text from clipboard and verify it is as expected.
4678 base::string16 result_text; 4726 base::string16 result_text;
4679 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4727 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4680 EXPECT_EQ(expected_text, result_text); 4728 EXPECT_EQ(expected_text, result_text);
4681 } 4729 }
4682 } 4730 }
4683 #endif 4731 #endif
4684 4732
4685 } // namespace content 4733 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698