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

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: Fix ALL THE TESTS. Hopefully. Created 4 years, 10 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 152
152 private: 153 private:
153 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAppWindowTest); 154 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardAppWindowTest);
154 }; 155 };
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(std::move(extensions::DictionaryBuilder() 162 .SetManifest(std::move(
162 .Set("name", "test extension") 163 extensions::DictionaryBuilder()
163 .Set("version", "1") 164 .Set("name", "test extension")
164 .Set("manifest_version", 2))) 165 .Set("version", "1")
166 .Set("manifest_version", 2)
167 .Set(
168 "background",
169 std::move(extensions::DictionaryBuilder().Set(
170 "scripts", std::move(extensions::ListBuilder().Append(
171 "background.js")))))))
dcheng 2016/02/26 22:52:29 Needed to fake out an extension background page: t
165 .Build(); 172 .Build();
166 173
174 extension_service()->AddExtension(extension.get());
167 extensions::AppWindow::CreateParams non_ime_params; 175 extensions::AppWindow::CreateParams non_ime_params;
168 non_ime_params.frame = extensions::AppWindow::FRAME_NONE; 176 non_ime_params.frame = extensions::AppWindow::FRAME_NONE;
169 extensions::AppWindow* non_ime_app_window = 177 extensions::AppWindow* non_ime_app_window = CreateAppWindowFromParams(
170 CreateAppWindowFromParams(extension.get(), non_ime_params); 178 browser()->profile(), extension.get(), non_ime_params);
171 int non_ime_window_visible_height = non_ime_app_window->web_contents() 179 int non_ime_window_visible_height = non_ime_app_window->web_contents()
172 ->GetRenderWidgetHostView() 180 ->GetRenderWidgetHostView()
173 ->GetVisibleViewportSize() 181 ->GetVisibleViewportSize()
174 .height(); 182 .height();
175 183
176 extensions::AppWindow::CreateParams ime_params; 184 extensions::AppWindow::CreateParams ime_params;
177 ime_params.frame = extensions::AppWindow::FRAME_NONE; 185 ime_params.frame = extensions::AppWindow::FRAME_NONE;
178 ime_params.is_ime_window = true; 186 ime_params.is_ime_window = true;
179 extensions::AppWindow* ime_app_window = 187 extensions::AppWindow* ime_app_window = CreateAppWindowFromParams(
180 CreateAppWindowFromParams(extension.get(), ime_params); 188 browser()->profile(), extension.get(), ime_params);
181 int ime_window_visible_height = ime_app_window->web_contents() 189 int ime_window_visible_height = ime_app_window->web_contents()
182 ->GetRenderWidgetHostView() 190 ->GetRenderWidgetHostView()
183 ->GetVisibleViewportSize() 191 ->GetVisibleViewportSize()
184 .height(); 192 .height();
185 193
186 ASSERT_EQ(non_ime_window_visible_height, ime_window_visible_height); 194 ASSERT_EQ(non_ime_window_visible_height, ime_window_visible_height);
187 ASSERT_TRUE(ime_window_visible_height > 0); 195 ASSERT_TRUE(ime_window_visible_height > 0);
188 196
189 int screen_height = ash::Shell::GetPrimaryRootWindow()->bounds().height(); 197 int screen_height = ash::Shell::GetPrimaryRootWindow()->bounds().height();
190 gfx::Rect test_bounds(0, 0, 0, screen_height - ime_window_visible_height + 1); 198 gfx::Rect test_bounds(0, 0, 0, screen_height - ime_window_visible_height + 1);
(...skipping 12 matching lines...) Expand all
203 ->GetVisibleViewportSize() 211 ->GetVisibleViewportSize()
204 .height(), 212 .height(),
205 non_ime_window_visible_height); 213 non_ime_window_visible_height);
206 // Ime window should have not be affected by virtual keyboard. 214 // Ime window should have not be affected by virtual keyboard.
207 EXPECT_EQ(ime_app_window->web_contents() 215 EXPECT_EQ(ime_app_window->web_contents()
208 ->GetRenderWidgetHostView() 216 ->GetRenderWidgetHostView()
209 ->GetVisibleViewportSize() 217 ->GetVisibleViewportSize()
210 .height(), 218 .height(),
211 ime_window_visible_height); 219 ime_window_visible_height);
212 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698