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

Side by Side Diff: ash/wm/resize_shadow_and_cursor_unittest.cc

Issue 169713003: Remove WindowState::IsNormalShowState() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/drag_details.cc ('k') | ash/wm/toplevel_window_event_handler.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ash_constants.h" 5 #include "ash/ash_constants.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "ash/test/cursor_manager_test_api.h" 8 #include "ash/test/cursor_manager_test_api.h"
9 #include "ash/wm/custom_frame_view_ash.h" 9 #include "ash/wm/custom_frame_view_ash.h"
10 #include "ash/wm/resize_shadow.h" 10 #include "ash/wm/resize_shadow.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 private: 110 private:
111 aura::Window* window_; 111 aura::Window* window_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(ResizeShadowAndCursorTest); 113 DISALLOW_COPY_AND_ASSIGN(ResizeShadowAndCursorTest);
114 }; 114 };
115 115
116 // Test whether the resize shadows are visible and the cursor type based on the 116 // Test whether the resize shadows are visible and the cursor type based on the
117 // mouse's position. 117 // mouse's position.
118 TEST_F(ResizeShadowAndCursorTest, MouseHover) { 118 TEST_F(ResizeShadowAndCursorTest, MouseHover) {
119 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 119 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
120 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowState()); 120 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowType());
121 121
122 generator.MoveMouseTo(50, 50); 122 generator.MoveMouseTo(50, 50);
123 EXPECT_FALSE(HasResizeShadow()); 123 EXPECT_FALSE(HasResizeShadow());
124 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); 124 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType());
125 125
126 generator.MoveMouseTo(gfx::Point(50, 0)); 126 generator.MoveMouseTo(gfx::Point(50, 0));
127 EXPECT_EQ(HTTOP, ResizeShadowHitTest()); 127 EXPECT_EQ(HTTOP, ResizeShadowHitTest());
128 EXPECT_EQ(ui::kCursorNorthResize, GetCurrentCursorType()); 128 EXPECT_EQ(ui::kCursorNorthResize, GetCurrentCursorType());
129 129
130 generator.MoveMouseTo(50, 50); 130 generator.MoveMouseTo(50, 50);
(...skipping 22 matching lines...) Expand all
153 153
154 generator.MoveMouseTo(50, 100 - ash::kResizeInsideBoundsSize - 10); 154 generator.MoveMouseTo(50, 100 - ash::kResizeInsideBoundsSize - 10);
155 EXPECT_FALSE(HasResizeShadow()); 155 EXPECT_FALSE(HasResizeShadow());
156 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); 156 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType());
157 } 157 }
158 158
159 // Test that the resize shadows stay visible and that the cursor stays the same 159 // Test that the resize shadows stay visible and that the cursor stays the same
160 // as long as a user is resizing a window. 160 // as long as a user is resizing a window.
161 TEST_F(ResizeShadowAndCursorTest, MouseDrag) { 161 TEST_F(ResizeShadowAndCursorTest, MouseDrag) {
162 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 162 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
163 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowState()); 163 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowType());
164 gfx::Size initial_size(window()->bounds().size()); 164 gfx::Size initial_size(window()->bounds().size());
165 165
166 generator.MoveMouseTo(100, 50); 166 generator.MoveMouseTo(100, 50);
167 generator.PressLeftButton(); 167 generator.PressLeftButton();
168 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 168 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
169 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 169 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
170 170
171 generator.MoveMouseTo(110, 50); 171 generator.MoveMouseTo(110, 50);
172 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 172 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
173 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 173 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
174 174
175 generator.ReleaseLeftButton(); 175 generator.ReleaseLeftButton();
176 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 176 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
177 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 177 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
178 178
179 gfx::Size new_size(window()->bounds().size()); 179 gfx::Size new_size(window()->bounds().size());
180 EXPECT_NE(new_size.ToString(), initial_size.ToString()); 180 EXPECT_NE(new_size.ToString(), initial_size.ToString());
181 } 181 }
182 182
183 // Test that the resize shadows stay visible while resizing a window via touch. 183 // Test that the resize shadows stay visible while resizing a window via touch.
184 TEST_F(ResizeShadowAndCursorTest, Touch) { 184 TEST_F(ResizeShadowAndCursorTest, Touch) {
185 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowState()); 185 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowType());
186 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 186 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
187 187
188 int start = 100 + ash::kResizeOutsideBoundsSize - 1; 188 int start = 100 + ash::kResizeOutsideBoundsSize - 1;
189 generator.GestureScrollSequenceWithCallback( 189 generator.GestureScrollSequenceWithCallback(
190 gfx::Point(start, start), 190 gfx::Point(start, start),
191 gfx::Point(start + 50, start + 50), 191 gfx::Point(start + 50, start + 50),
192 base::TimeDelta::FromMilliseconds(100), 192 base::TimeDelta::FromMilliseconds(100),
193 3, 193 3,
194 base::Bind(&ResizeShadowAndCursorTest::ProcessBottomRightResizeGesture, 194 base::Bind(&ResizeShadowAndCursorTest::ProcessBottomRightResizeGesture,
195 base::Unretained(this))); 195 base::Unretained(this)));
196 } 196 }
197 197
198 // Test that the resize shadows are not visible and that the default cursor is 198 // Test that the resize shadows are not visible and that the default cursor is
199 // used when the window is maximized. 199 // used when the window is maximized.
200 TEST_F(ResizeShadowAndCursorTest, MaximizeRestore) { 200 TEST_F(ResizeShadowAndCursorTest, MaximizeRestore) {
201 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 201 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
202 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowState()); 202 ASSERT_TRUE(ash::wm::GetWindowState(window())->IsNormalShowType());
203 203
204 generator.MoveMouseTo(100, 50); 204 generator.MoveMouseTo(100, 50);
205 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 205 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
206 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 206 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
207 generator.MoveMouseTo(100 - ash::kResizeInsideBoundsSize, 50); 207 generator.MoveMouseTo(100 - ash::kResizeInsideBoundsSize, 50);
208 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 208 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
209 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 209 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
210 210
211 ash::wm::GetWindowState(window())->Maximize(); 211 ash::wm::GetWindowState(window())->Maximize();
212 gfx::Rect bounds(window()->GetBoundsInRootWindow()); 212 gfx::Rect bounds(window()->GetBoundsInRootWindow());
213 gfx::Point right_center(bounds.right() - 1, 213 gfx::Point right_center(bounds.right() - 1,
214 (bounds.y() + bounds.bottom()) / 2); 214 (bounds.y() + bounds.bottom()) / 2);
215 generator.MoveMouseTo(right_center); 215 generator.MoveMouseTo(right_center);
216 EXPECT_FALSE(HasResizeShadow()); 216 EXPECT_FALSE(HasResizeShadow());
217 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType()); 217 EXPECT_EQ(ui::kCursorNull, GetCurrentCursorType());
218 218
219 ash::wm::GetWindowState(window())->Restore(); 219 ash::wm::GetWindowState(window())->Restore();
220 generator.MoveMouseTo(100, 50); 220 generator.MoveMouseTo(100, 50);
221 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 221 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
222 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 222 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
223 generator.MoveMouseTo(100 - ash::kResizeInsideBoundsSize, 50); 223 generator.MoveMouseTo(100 - ash::kResizeInsideBoundsSize, 50);
224 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); 224 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest());
225 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); 225 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType());
226 } 226 }
227 227
228 } // namespace test 228 } // namespace test
229 } // namespace ash 229 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/drag_details.cc ('k') | ash/wm/toplevel_window_event_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698