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

Side by Side Diff: chrome/browser/ui/ash/keyboard_controller_browsertest.cc

Issue 1323053005: Fix cropped floating gesture candidate window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 5 years, 2 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/ash/chrome_keyboard_ui.cc ('k') | ui/keyboard/content/keyboard_ui_content.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "chrome/browser/apps/app_browsertest_util.h"
8 #include "chrome/browser/profiles/profile_manager.h"
7 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "content/public/browser/render_widget_host_view.h"
8 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "extensions/browser/app_window/app_window.h"
13 #include "extensions/common/extension.h"
14 #include "extensions/common/extension_builder.h"
15 #include "extensions/common/value_builder.h"
9 #include "ui/base/ime/dummy_text_input_client.h" 16 #include "ui/base/ime/dummy_text_input_client.h"
10 #include "ui/base/ime/input_method.h" 17 #include "ui/base/ime/input_method.h"
11 #include "ui/base/ime/input_method_factory.h" 18 #include "ui/base/ime/input_method_factory.h"
12 #include "ui/keyboard/content/keyboard_constants.h" 19 #include "ui/keyboard/content/keyboard_constants.h"
13 #include "ui/keyboard/keyboard_controller.h" 20 #include "ui/keyboard/keyboard_controller.h"
14 #include "ui/keyboard/keyboard_switches.h" 21 #include "ui/keyboard/keyboard_switches.h"
15 #include "ui/keyboard/keyboard_ui.h" 22 #include "ui/keyboard/keyboard_ui.h"
16 #include "ui/keyboard/keyboard_util.h" 23 #include "ui/keyboard/keyboard_util.h"
17 24
18 namespace { 25 namespace {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ui()->GetKeyboardWindow()->SetBounds(gfx::Rect(50, 50, 50, 50)); 130 ui()->GetKeyboardWindow()->SetBounds(gfx::Rect(50, 50, 50, 50));
124 EXPECT_EQ(gfx::Rect(50, 50, 50, 50), 131 EXPECT_EQ(gfx::Rect(50, 50, 50, 50),
125 controller->GetContainerWindow()->bounds()); 132 controller->GetContainerWindow()->bounds());
126 133
127 MockEnableIMEInDifferentExtension("chrome-extension://domain-1", test_bounds); 134 MockEnableIMEInDifferentExtension("chrome-extension://domain-1", test_bounds);
128 keyboard_bounds = controller->GetContainerWindow()->bounds(); 135 keyboard_bounds = controller->GetContainerWindow()->bounds();
129 EXPECT_EQ(kKeyboardHeightForTest, keyboard_bounds.height()); 136 EXPECT_EQ(kKeyboardHeightForTest, keyboard_bounds.height());
130 EXPECT_EQ(screen_bounds.height(), 137 EXPECT_EQ(screen_bounds.height(),
131 keyboard_bounds.height() + keyboard_bounds.y()); 138 keyboard_bounds.height() + keyboard_bounds.y());
132 } 139 }
140
141 class VirtualKeyboardAppWindowTest : public extensions::PlatformAppBrowserTest {
142 public:
143 VirtualKeyboardAppWindowTest() {}
144 ~VirtualKeyboardAppWindowTest() override {}
145
146 // Ensure that the virtual keyboard is enabled.
147 void SetUpCommandLine(base::CommandLine* command_line) override {
148 command_line->AppendSwitch(keyboard::switches::kEnableVirtualKeyboard);
149 }
150
151 private:
152 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAppWindowTest);
153 };
154
155 // Tests that ime window won't overscroll. See crbug.com/529880.
156 IN_PROC_BROWSER_TEST_F(VirtualKeyboardAppWindowTest,
157 DisableOverscrollForImeWindow) {
158 scoped_refptr<extensions::Extension> extension =
159 extensions::ExtensionBuilder()
160 .SetManifest(extensions::DictionaryBuilder()
161 .Set("name", "test extension")
162 .Set("version", "1")
163 .Set("manifest_version", 2))
164 .Build();
165
166 extensions::AppWindow::CreateParams non_ime_params;
167 non_ime_params.frame = extensions::AppWindow::FRAME_NONE;
168 extensions::AppWindow* non_ime_app_window =
169 CreateAppWindowFromParams(extension.get(), non_ime_params);
170 int non_ime_window_visible_height = non_ime_app_window->web_contents()
171 ->GetRenderWidgetHostView()
172 ->GetVisibleViewportSize()
173 .height();
174
175 extensions::AppWindow::CreateParams ime_params;
176 ime_params.frame = extensions::AppWindow::FRAME_NONE;
177 ime_params.is_ime_window = true;
178 extensions::AppWindow* ime_app_window =
179 CreateAppWindowFromParams(extension.get(), ime_params);
180 int ime_window_visible_height = ime_app_window->web_contents()
181 ->GetRenderWidgetHostView()
182 ->GetVisibleViewportSize()
183 .height();
184
185 ASSERT_EQ(non_ime_window_visible_height, ime_window_visible_height);
186 ASSERT_TRUE(ime_window_visible_height > 0);
187
188 int screen_height = ash::Shell::GetPrimaryRootWindow()->bounds().height();
189 gfx::Rect test_bounds(0, 0, 0, screen_height - ime_window_visible_height + 1);
190 keyboard::KeyboardController* controller =
191 keyboard::KeyboardController::GetInstance();
192 controller->ShowKeyboard(true);
193 controller->ui()->GetKeyboardWindow()->SetBounds(test_bounds);
194 gfx::Rect keyboard_bounds = controller->GetContainerWindow()->bounds();
195 // Starts overscroll.
196 controller->NotifyKeyboardBoundsChanging(keyboard_bounds);
197
198 // Non ime window should have smaller visible view port due to overlap with
199 // virtual keyboard.
200 EXPECT_LT(non_ime_app_window->web_contents()
201 ->GetRenderWidgetHostView()
202 ->GetVisibleViewportSize()
203 .height(),
204 non_ime_window_visible_height);
205 // Ime window should have not be affected by virtual keyboard.
206 EXPECT_EQ(ime_app_window->web_contents()
207 ->GetRenderWidgetHostView()
208 ->GetVisibleViewportSize()
209 .height(),
210 ime_window_visible_height);
211 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_keyboard_ui.cc ('k') | ui/keyboard/content/keyboard_ui_content.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698