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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 | Annotate | Revision Log
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 return static_cast<BrowserView*>(browser()->window()); 1274 return static_cast<BrowserView*>(browser()->window());
1275 } 1275 }
1276 1276
1277 const views::View* GetFocusView() const { 1277 const views::View* GetFocusView() const {
1278 return GetBrowserView()->GetViewByID(location_bar_focus_view_id_); 1278 return GetBrowserView()->GetViewByID(location_bar_focus_view_id_);
1279 } 1279 }
1280 1280
1281 // Move the mouse to the center of the browser window and left-click. 1281 // Move the mouse to the center of the browser window and left-click.
1282 void ClickBrowserWindowCenter() { 1282 void ClickBrowserWindowCenter() {
1283 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( 1283 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(
1284 GetBrowserView()->GetScreenBounds().CenterPoint())); 1284 GetBrowserView()->GetBoundsInScreen().CenterPoint()));
1285 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 1285 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
1286 ui_controls::LEFT, ui_controls::DOWN)); 1286 ui_controls::LEFT, ui_controls::DOWN));
1287 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 1287 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
1288 ui_controls::LEFT, ui_controls::UP)); 1288 ui_controls::LEFT, ui_controls::UP));
1289 } 1289 }
1290 1290
1291 // Press and release the mouse in the focus view at an offset from its origin. 1291 // Press and release the mouse in the focus view at an offset from its origin.
1292 // If |release_offset| differs from |press_offset|, the mouse will be moved 1292 // If |release_offset| differs from |press_offset|, the mouse will be moved
1293 // between the press and release. 1293 // between the press and release.
1294 void ClickFocusViewOrigin(ui_controls::MouseButton button, 1294 void ClickFocusViewOrigin(ui_controls::MouseButton button,
1295 const gfx::Point& press_offset, 1295 const gfx::Point& press_offset,
1296 const gfx::Point& release_offset) { 1296 const gfx::Point& release_offset) {
1297 gfx::Point focus_view_origin = GetFocusView()->GetScreenBounds().origin(); 1297 gfx::Point focus_view_origin = GetFocusView()->GetBoundsInScreen().origin();
1298 gfx::Point press_point = focus_view_origin; 1298 gfx::Point press_point = focus_view_origin;
1299 press_point.Offset(press_offset.x(), press_offset.y()); 1299 press_point.Offset(press_offset.x(), press_offset.y());
1300 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(press_point)); 1300 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(press_point));
1301 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::DOWN)); 1301 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::DOWN));
1302 1302
1303 gfx::Point release_point = focus_view_origin; 1303 gfx::Point release_point = focus_view_origin;
1304 release_point.Offset(release_offset.x(), release_offset.y()); 1304 release_point.Offset(release_offset.x(), release_offset.y());
1305 if (release_point != press_point) 1305 if (release_point != press_point)
1306 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(release_point)); 1306 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(release_point));
1307 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::UP)); 1307 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::UP));
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 1665
1666 // Middle-clicking shouldn't select all the text either. 1666 // Middle-clicking shouldn't select all the text either.
1667 ASSERT_NO_FATAL_FAILURE( 1667 ASSERT_NO_FATAL_FAILURE(
1668 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset)); 1668 ClickFocusViewOrigin(ui_controls::LEFT, kClickOffset, kClickOffset));
1669 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter()); 1669 ASSERT_NO_FATAL_FAILURE(ClickBrowserWindowCenter());
1670 ASSERT_NO_FATAL_FAILURE( 1670 ASSERT_NO_FATAL_FAILURE(
1671 ClickFocusViewOrigin(ui_controls::MIDDLE, kClickOffset, kClickOffset)); 1671 ClickFocusViewOrigin(ui_controls::MIDDLE, kClickOffset, kClickOffset));
1672 EXPECT_FALSE(omnibox_view->IsSelectAll()); 1672 EXPECT_FALSE(omnibox_view->IsSelectAll());
1673 } 1673 }
1674 #endif // defined(USE_AURA) 1674 #endif // defined(USE_AURA)
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/data_promo_notification.cc ('k') | chrome/browser/ui/panels/panel_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698