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

Side by Side Diff: chrome/browser/chromeos/accessibility/magnification_controller_browsertest.cc

Issue 2660873002: Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h (Closed)
Patch Set: rebase Created 3 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 <string> 5 #include <string>
6 6
7 #include "ash/magnifier/magnification_controller.h" 7 #include "ash/magnifier/magnification_controller.h"
8 #include "ash/screen_util.h"
9 #include "ash/shell.h" 8 #include "ash/shell.h"
10 #include "base/command_line.h" 9 #include "base/command_line.h"
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
13 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
15 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
21 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
22 #include "content/public/test/browser_test_utils.h" 21 #include "content/public/test/browser_test_utils.h"
23 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/wm/core/coordinate_conversion.h"
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 namespace { 27 namespace {
28 28
29 const char kDataURIPrefix[] = "data:text/html;charset=utf-8,"; 29 const char kDataURIPrefix[] = "data:text/html;charset=utf-8,";
30 const char kTestHtmlContent1[] = 30 const char kTestHtmlContent1[] =
31 "<body style=\"margin-top:0;margin-left:0\">" 31 "<body style=\"margin-top:0;margin-left:0\">"
32 "<button type=\"button\" name=\"test_button_1\" id=\"test_button\" " 32 "<button type=\"button\" name=\"test_button_1\" id=\"test_button\" "
33 "style=\"margin-left:200;margin-top:200;width:100;height:50\">" 33 "style=\"margin-left:200;margin-top:200;width:100;height:50\">"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ExecuteScriptAndExtractInt("bounds.height", &height); 144 ExecuteScriptAndExtractInt("bounds.height", &height);
145 gfx::Rect rect(top, left, width, height); 145 gfx::Rect rect(top, left, width, height);
146 146
147 content::RenderWidgetHostView* view = 147 content::RenderWidgetHostView* view =
148 GetWebContents()->GetRenderWidgetHostView(); 148 GetWebContents()->GetRenderWidgetHostView();
149 gfx::Rect view_bounds_in_screen = view->GetViewBounds(); 149 gfx::Rect view_bounds_in_screen = view->GetViewBounds();
150 gfx::Point origin = rect.origin(); 150 gfx::Point origin = rect.origin();
151 origin.Offset(view_bounds_in_screen.x(), view_bounds_in_screen.y()); 151 origin.Offset(view_bounds_in_screen.x(), view_bounds_in_screen.y());
152 gfx::Rect rect_in_screen(origin.x(), origin.y(), rect.width(), 152 gfx::Rect rect_in_screen(origin.x(), origin.y(), rect.width(),
153 rect.height()); 153 rect.height());
154 154 ::wm::ConvertRectFromScreen(GetRootWindow(), &rect_in_screen);
155 return ash::ScreenUtil::ConvertRectFromScreen(GetRootWindow(), 155 return rect_in_screen;
156 rect_in_screen);
157 } 156 }
158 157
159 void SetFocusOnElement(const std::string& element_id) { 158 void SetFocusOnElement(const std::string& element_id) {
160 ExecuteScript("document.getElementById('" + element_id + "').focus();"); 159 ExecuteScript("document.getElementById('" + element_id + "').focus();");
161 } 160 }
162 161
163 private: 162 private:
164 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest); 163 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest);
165 }; 164 };
166 165
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Set the focus on the button. 220 // Set the focus on the button.
222 SetFocusOnElement("test_button"); 221 SetFocusOnElement("test_button");
223 222
224 // Verify the magnifier window is not moved and still contains the button. 223 // Verify the magnifier window is not moved and still contains the button.
225 const gfx::Rect view_port_after_focus = GetViewPort(); 224 const gfx::Rect view_port_after_focus = GetViewPort();
226 EXPECT_TRUE(view_port_after_focus.Contains(button_bounds)); 225 EXPECT_TRUE(view_port_after_focus.Contains(button_bounds));
227 EXPECT_EQ(view_port_before_focus, view_port_after_focus); 226 EXPECT_EQ(view_port_before_focus, view_port_after_focus);
228 } 227 }
229 228
230 } // namespace chromeos 229 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/wm/window_animations.cc ('k') | chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698