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

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: reupload 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 3788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode()); 3901 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->current_mode());
3897 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); 3902 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode());
3898 3903
3899 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, 3904 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
3900 blink::WebGestureDeviceTouchscreen); 3905 blink::WebGestureDeviceTouchscreen);
3901 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); 3906 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode());
3902 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); 3907 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode());
3903 EXPECT_EQ(3U, sink_->message_count()); 3908 EXPECT_EQ(3U, sink_->message_count());
3904 } 3909 }
3905 3910
3911 #if defined(OS_CHROMEOS)
3912 // Check that when accessibility virtual keyboard is enabled, windows are
3913 // shifted up when focused and restored when focus is lost.
3914 TEST_F(RenderWidgetHostViewAuraOverscrollTest,
3915 VirtualKeyboardFocusEnsureCaretInRect) {
3916 SetUpOverscrollEnvironment();
3917 // TODO (oshima): Test that overscroll occurs.
3918
3919 // Enable new virtual keyboard behavior.
3920 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
3921 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) {
3922 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior);
3923 }
3924
3925 aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow();
3926 ui::InputMethod* input_method = root_window->GetHost()->GetInputMethod();
3927 int keyboard_height = 200;
3928 gfx::Rect root_bounds = root_window->bounds();
3929 gfx::Rect orig_view_bounds = gfx::Rect(0, 300, 400, 200);
3930 gfx::Rect shifted_view_bounds = gfx::Rect(0, 200, 400, 200);
3931 gfx::Rect keyboard_view_bounds =
3932 gfx::Rect(0, root_bounds.height() - keyboard_height, root_bounds.width(),
3933 keyboard_height);
3934
3935 // Focus the window.
3936 view_->SetBounds(orig_view_bounds);
3937 input_method->SetFocusedTextInputClient(view_);
3938 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3939
3940 // Simulate virtual keyboard.
3941 input_method->SetCoveredBounds(keyboard_view_bounds);
3942
3943 // Window should be shifted.
3944 EXPECT_EQ(view_->GetNativeView()->bounds(), shifted_view_bounds);
3945
3946 // Change the focus.
3947 input_method->SetFocusedTextInputClient(nullptr);
3948
3949 // Window should be restored.
3950 EXPECT_EQ(view_->GetNativeView()->bounds(), orig_view_bounds);
3951 }
3952 #endif // defined(OS_CHROMEOS)
3953
3906 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 3954 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted
3907 // before RWH), we clean up properly and don't leak the RWHVGuest. 3955 // before RWH), we clean up properly and don't leak the RWHVGuest.
3908 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 3956 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
3909 view_->InitAsChild(nullptr); 3957 view_->InitAsChild(nullptr);
3910 TearDownEnvironment(); 3958 TearDownEnvironment();
3911 ASSERT_FALSE(guest_view_weak_.get()); 3959 ASSERT_FALSE(guest_view_weak_.get());
3912 } 3960 }
3913 3961
3914 // Tests that invalid touch events are consumed and handled 3962 // Tests that invalid touch events are consumed and handled
3915 // synchronously. 3963 // synchronously.
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
4674 4722
4675 // Retrieve the selected text from clipboard and verify it is as expected. 4723 // Retrieve the selected text from clipboard and verify it is as expected.
4676 base::string16 result_text; 4724 base::string16 result_text;
4677 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4725 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4678 EXPECT_EQ(expected_text, result_text); 4726 EXPECT_EQ(expected_text, result_text);
4679 } 4727 }
4680 } 4728 }
4681 #endif 4729 #endif
4682 4730
4683 } // namespace content 4731 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698