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

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

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
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 "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/apps/app_browsertest_util.h" 8 #include "chrome/browser/apps/app_browsertest_util.h"
9 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "content/public/browser/render_widget_host_view.h" 12 #include "content/public/browser/render_widget_host_view.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "extensions/browser/app_window/app_window.h" 14 #include "extensions/browser/app_window/app_window.h"
14 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
15 #include "extensions/common/extension_builder.h" 16 #include "extensions/common/extension_builder.h"
16 #include "extensions/common/value_builder.h" 17 #include "extensions/common/value_builder.h"
17 #include "ui/base/ime/dummy_text_input_client.h" 18 #include "ui/base/ime/dummy_text_input_client.h"
18 #include "ui/base/ime/input_method.h" 19 #include "ui/base/ime/input_method.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 156
156 // Tests that ime window won't overscroll. See crbug.com/529880. 157 // Tests that ime window won't overscroll. See crbug.com/529880.
157 IN_PROC_BROWSER_TEST_F(VirtualKeyboardAppWindowTest, 158 IN_PROC_BROWSER_TEST_F(VirtualKeyboardAppWindowTest,
158 DisableOverscrollForImeWindow) { 159 DisableOverscrollForImeWindow) {
159 scoped_refptr<extensions::Extension> extension = 160 scoped_refptr<extensions::Extension> extension =
160 extensions::ExtensionBuilder() 161 extensions::ExtensionBuilder()
161 .SetManifest(extensions::DictionaryBuilder() 162 .SetManifest(extensions::DictionaryBuilder()
162 .Set("name", "test extension") 163 .Set("name", "test extension")
163 .Set("version", "1") 164 .Set("version", "1")
164 .Set("manifest_version", 2) 165 .Set("manifest_version", 2)
166 .Set("background",
167 extensions::DictionaryBuilder()
168 .Set("scripts", extensions::ListBuilder()
169 .Append("background.js")
170 .Build())
171 .Build())
165 .Build()) 172 .Build())
166 .Build(); 173 .Build();
167 174
175 extension_service()->AddExtension(extension.get());
168 extensions::AppWindow::CreateParams non_ime_params; 176 extensions::AppWindow::CreateParams non_ime_params;
169 non_ime_params.frame = extensions::AppWindow::FRAME_NONE; 177 non_ime_params.frame = extensions::AppWindow::FRAME_NONE;
170 extensions::AppWindow* non_ime_app_window = 178 extensions::AppWindow* non_ime_app_window = CreateAppWindowFromParams(
171 CreateAppWindowFromParams(extension.get(), non_ime_params); 179 browser()->profile(), extension.get(), non_ime_params);
172 int non_ime_window_visible_height = non_ime_app_window->web_contents() 180 int non_ime_window_visible_height = non_ime_app_window->web_contents()
173 ->GetRenderWidgetHostView() 181 ->GetRenderWidgetHostView()
174 ->GetVisibleViewportSize() 182 ->GetVisibleViewportSize()
175 .height(); 183 .height();
176 184
177 extensions::AppWindow::CreateParams ime_params; 185 extensions::AppWindow::CreateParams ime_params;
178 ime_params.frame = extensions::AppWindow::FRAME_NONE; 186 ime_params.frame = extensions::AppWindow::FRAME_NONE;
179 ime_params.is_ime_window = true; 187 ime_params.is_ime_window = true;
180 extensions::AppWindow* ime_app_window = 188 extensions::AppWindow* ime_app_window = CreateAppWindowFromParams(
181 CreateAppWindowFromParams(extension.get(), ime_params); 189 browser()->profile(), extension.get(), ime_params);
182 int ime_window_visible_height = ime_app_window->web_contents() 190 int ime_window_visible_height = ime_app_window->web_contents()
183 ->GetRenderWidgetHostView() 191 ->GetRenderWidgetHostView()
184 ->GetVisibleViewportSize() 192 ->GetVisibleViewportSize()
185 .height(); 193 .height();
186 194
187 ASSERT_EQ(non_ime_window_visible_height, ime_window_visible_height); 195 ASSERT_EQ(non_ime_window_visible_height, ime_window_visible_height);
188 ASSERT_TRUE(ime_window_visible_height > 0); 196 ASSERT_TRUE(ime_window_visible_height > 0);
189 197
190 int screen_height = ash::Shell::GetPrimaryRootWindow()->bounds().height(); 198 int screen_height = ash::Shell::GetPrimaryRootWindow()->bounds().height();
191 gfx::Rect test_bounds(0, 0, 0, screen_height - ime_window_visible_height + 1); 199 gfx::Rect test_bounds(0, 0, 0, screen_height - ime_window_visible_height + 1);
(...skipping 12 matching lines...) Expand all
204 ->GetVisibleViewportSize() 212 ->GetVisibleViewportSize()
205 .height(), 213 .height(),
206 non_ime_window_visible_height); 214 non_ime_window_visible_height);
207 // Ime window should have not be affected by virtual keyboard. 215 // Ime window should have not be affected by virtual keyboard.
208 EXPECT_EQ(ime_app_window->web_contents() 216 EXPECT_EQ(ime_app_window->web_contents()
209 ->GetRenderWidgetHostView() 217 ->GetRenderWidgetHostView()
210 ->GetVisibleViewportSize() 218 ->GetVisibleViewportSize()
211 .height(), 219 .height(),
212 ime_window_visible_height); 220 ime_window_visible_height);
213 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698