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

Side by Side Diff: ash/wm/panel_layout_manager_unittest.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
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | ash/wm/shelf_layout_manager.cc » ('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 (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 "ash/wm/panel_layout_manager.h" 5 #include "ash/wm/panel_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // TODO(dcheng): This should be const, but GetScreenBoundsOfItemIconForWindow 73 // TODO(dcheng): This should be const, but GetScreenBoundsOfItemIconForWindow
74 // takes a non-const Window. We can probably fix that. 74 // takes a non-const Window. We can probably fix that.
75 void IsPanelAboveLauncherIcon(aura::Window* panel) { 75 void IsPanelAboveLauncherIcon(aura::Window* panel) {
76 // Waits until all launcher view animations are done. 76 // Waits until all launcher view animations are done.
77 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); 77 launcher_view_test()->RunMessageLoopUntilAnimationsDone();
78 78
79 Launcher* launcher = Shell::GetInstance()->launcher(); 79 Launcher* launcher = Shell::GetInstance()->launcher();
80 gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); 80 gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel);
81 ASSERT_FALSE(icon_bounds.IsEmpty()); 81 ASSERT_FALSE(icon_bounds.IsEmpty());
82 82
83 gfx::Rect window_bounds = panel->GetRootWindowBounds(); 83 gfx::Rect window_bounds = panel->GetBoundsInRootWindow();
84 84
85 // 1-pixel tolerance--since we center panels over their icons, panels with 85 // 1-pixel tolerance--since we center panels over their icons, panels with
86 // odd pixel widths won't be perfectly lined up with even pixel width 86 // odd pixel widths won't be perfectly lined up with even pixel width
87 // launcher icons. 87 // launcher icons.
88 EXPECT_NEAR(icon_bounds.CenterPoint().x(), 88 EXPECT_NEAR(icon_bounds.CenterPoint().x(),
89 window_bounds.CenterPoint().x(), 89 window_bounds.CenterPoint().x(),
90 1); 90 1);
91 EXPECT_EQ(launcher->widget()->GetWindowScreenBounds().y(), 91 EXPECT_EQ(launcher->widget()->GetWindowBoundsInScreen().y(),
92 window_bounds.bottom()); 92 window_bounds.bottom());
93 } 93 }
94 94
95 void IsCalloutAbovePanel(aura::Window* panel) { 95 void IsCalloutAbovePanel(aura::Window* panel) {
96 // Flush the message loop, since callout updates use a delayed task. 96 // Flush the message loop, since callout updates use a delayed task.
97 MessageLoop::current()->RunAllPending(); 97 MessageLoop::current()->RunAllPending();
98 views::Widget* widget = NULL; 98 views::Widget* widget = NULL;
99 GetCalloutWidget(&widget); 99 GetCalloutWidget(&widget);
100 EXPECT_TRUE(widget->IsVisible()); 100 EXPECT_TRUE(widget->IsVisible());
101 EXPECT_EQ(panel->GetRootWindowBounds().bottom(), 101 EXPECT_EQ(panel->GetBoundsInRootWindow().bottom(),
102 widget->GetWindowScreenBounds().y()); 102 widget->GetWindowBoundsInScreen().y());
103 EXPECT_NEAR(panel->GetRootWindowBounds().CenterPoint().x(), 103 EXPECT_NEAR(panel->GetBoundsInRootWindow().CenterPoint().x(),
104 widget->GetWindowScreenBounds().CenterPoint().x(), 104 widget->GetWindowBoundsInScreen().CenterPoint().x(),
105 1); 105 1);
106 } 106 }
107 107
108 bool IsCalloutVisible() { 108 bool IsCalloutVisible() {
109 views::Widget* widget = NULL; 109 views::Widget* widget = NULL;
110 GetCalloutWidget(&widget); 110 GetCalloutWidget(&widget);
111 return widget->IsVisible(); 111 return widget->IsVisible();
112 } 112 }
113 113
114 test::LauncherViewTestAPI* launcher_view_test() { 114 test::LauncherViewTestAPI* launcher_view_test() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 wm::ActivateWindow(w2.get()); 253 wm::ActivateWindow(w2.get());
254 // Windows should be stacked 1 < 2 > 3 254 // Windows should be stacked 1 < 2 > 3
255 w1.reset(); 255 w1.reset();
256 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w2.get())); 256 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w2.get()));
257 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w3.get())); 257 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w3.get()));
258 EXPECT_TRUE(WindowIsAbove(w2.get(), w3.get())); 258 EXPECT_TRUE(WindowIsAbove(w2.get(), w3.get()));
259 } 259 }
260 260
261 } // namespace internal 261 } // namespace internal
262 } // namespace ash 262 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | ash/wm/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698