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

Side by Side Diff: ash/wm/panels/panel_window_resizer_unittest.cc

Issue 14969008: Removes the space for notification icon if it's not visible (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/system/status_area_widget_delegate.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/wm/panels/panel_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 17 matching lines...) Expand all
28 namespace ash { 28 namespace ash {
29 namespace internal { 29 namespace internal {
30 30
31 class PanelWindowResizerTest : public test::AshTestBase { 31 class PanelWindowResizerTest : public test::AshTestBase {
32 public: 32 public:
33 PanelWindowResizerTest() {} 33 PanelWindowResizerTest() {}
34 virtual ~PanelWindowResizerTest() {} 34 virtual ~PanelWindowResizerTest() {}
35 35
36 virtual void SetUp() OVERRIDE { 36 virtual void SetUp() OVERRIDE {
37 AshTestBase::SetUp(); 37 AshTestBase::SetUp();
38 UpdateDisplay("600x400");
38 test::ShellTestApi test_api(Shell::GetInstance()); 39 test::ShellTestApi test_api(Shell::GetInstance());
39 model_ = test_api.launcher_model(); 40 model_ = test_api.launcher_model();
40 } 41 }
41 42
42 virtual void TearDown() OVERRIDE { 43 virtual void TearDown() OVERRIDE {
43 AshTestBase::TearDown(); 44 AshTestBase::TearDown();
44 } 45 }
45 46
46 protected: 47 protected:
47 gfx::Point CalculateDragPoint(const PanelWindowResizer& resizer, 48 gfx::Point CalculateDragPoint(const PanelWindowResizer& resizer,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachMultipleDisplays) { 257 TEST_F(PanelWindowResizerTest, MAYBE_PanelDetachReattachMultipleDisplays) {
257 UpdateDisplay("600x400,600x400"); 258 UpdateDisplay("600x400,600x400");
258 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 259 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
259 scoped_ptr<aura::Window> window( 260 scoped_ptr<aura::Window> window(
260 CreatePanelWindow(gfx::Rect(600, 0, 201, 201))); 261 CreatePanelWindow(gfx::Rect(600, 0, 201, 201)));
261 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 262 EXPECT_EQ(root_windows[1], window->GetRootWindow());
262 DetachReattachTest(window.get(), 0, -1); 263 DetachReattachTest(window.get(), 0, -1);
263 } 264 }
264 265
265 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenDragAcrossDisplays) { 266 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenDragAcrossDisplays) {
266 UpdateDisplay("400x400,400x400"); 267 UpdateDisplay("600x400,600x400");
267 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 268 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
268 scoped_ptr<aura::Window> window( 269 scoped_ptr<aura::Window> window(
269 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 270 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
270 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 271 gfx::Rect initial_bounds = window->GetBoundsInScreen();
271 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 272 EXPECT_EQ(root_windows[0], window->GetRootWindow());
272 DragStart(window.get()); 273 DragStart(window.get());
273 DragMove(0, -100); 274 DragMove(0, -100);
274 DragEnd(); 275 DragEnd();
275 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 276 EXPECT_EQ(root_windows[0], window->GetRootWindow());
276 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); 277 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
277 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 278 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
278 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 279 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
279 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 280 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
280 window->parent()->id()); 281 window->parent()->id());
281 282
282 DragStart(window.get()); 283 DragStart(window.get());
283 DragMove(500, 0); 284 DragMove(500, 0);
284 DragEnd(); 285 DragEnd();
285 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 286 EXPECT_EQ(root_windows[1], window->GetRootWindow());
286 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 287 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
287 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 288 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
288 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 289 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
289 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 290 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
290 window->parent()->id()); 291 window->parent()->id());
291 } 292 }
292 293
293 TEST_F(PanelWindowResizerTest, MAYBE_DetachAcrossDisplays) { 294 TEST_F(PanelWindowResizerTest, MAYBE_DetachAcrossDisplays) {
294 UpdateDisplay("400x400,400x400"); 295 UpdateDisplay("600x400,600x400");
295 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 296 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
296 scoped_ptr<aura::Window> window( 297 scoped_ptr<aura::Window> window(
297 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 298 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
298 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 299 gfx::Rect initial_bounds = window->GetBoundsInScreen();
299 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 300 EXPECT_EQ(root_windows[0], window->GetRootWindow());
300 DragStart(window.get()); 301 DragStart(window.get());
301 DragMove(500, -100); 302 DragMove(500, -100);
302 DragEnd(); 303 DragEnd();
303 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 304 EXPECT_EQ(root_windows[1], window->GetRootWindow());
304 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 305 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
305 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); 306 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
306 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 307 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
307 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer, 308 EXPECT_EQ(internal::kShellWindowId_WorkspaceContainer,
308 window->parent()->id()); 309 window->parent()->id());
309 } 310 }
310 311
311 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenAttachToSecondDisplay) { 312 TEST_F(PanelWindowResizerTest, MAYBE_DetachThenAttachToSecondDisplay) {
312 UpdateDisplay("400x400,400x600"); 313 UpdateDisplay("600x400,600x600");
313 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 314 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
314 scoped_ptr<aura::Window> window( 315 scoped_ptr<aura::Window> window(
315 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 316 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
316 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 317 gfx::Rect initial_bounds = window->GetBoundsInScreen();
317 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 318 EXPECT_EQ(root_windows[0], window->GetRootWindow());
318 319
319 // Detach the window. 320 // Detach the window.
320 DragStart(window.get()); 321 DragStart(window.get());
321 DragMove(0, -100); 322 DragMove(0, -100);
322 DragEnd(); 323 DragEnd();
323 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 324 EXPECT_EQ(root_windows[0], window->GetRootWindow());
324 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); 325 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey));
325 326
326 // Drag the window just above the other display's launcher. 327 // Drag the window just above the other display's launcher.
327 DragStart(window.get()); 328 DragStart(window.get());
328 DragMove(500, 295); 329 DragMove(500, 295);
329 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 330 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
330 331
331 // Should stick to other launcher. 332 // Should stick to other launcher.
332 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); 333 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y());
333 DragEnd(); 334 DragEnd();
334 335
335 // When dropped should move to second display's panel container. 336 // When dropped should move to second display's panel container.
336 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 337 EXPECT_EQ(root_windows[1], window->GetRootWindow());
337 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); 338 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey));
338 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); 339 EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id());
339 } 340 }
340 341
341 TEST_F(PanelWindowResizerTest, MAYBE_AttachToSecondDisplay) { 342 TEST_F(PanelWindowResizerTest, MAYBE_AttachToSecondDisplay) {
342 UpdateDisplay("400x400,400x600"); 343 UpdateDisplay("600x400,600x600");
343 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 344 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
344 scoped_ptr<aura::Window> window( 345 scoped_ptr<aura::Window> window(
345 CreatePanelWindow(gfx::Rect(0, 0, 201, 201))); 346 CreatePanelWindow(gfx::Rect(0, 0, 201, 201)));
346 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 347 gfx::Rect initial_bounds = window->GetBoundsInScreen();
347 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 348 EXPECT_EQ(root_windows[0], window->GetRootWindow());
348 349
349 // Drag the window just above the other display's launcher. 350 // Drag the window just above the other display's launcher.
350 DragStart(window.get()); 351 DragStart(window.get());
351 DragMove(500, 195); 352 DragMove(500, 195);
352 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); 353 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 416 }
416 417
417 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) { 418 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) {
418 ash::Shell* shell = ash::Shell::GetInstance(); 419 ash::Shell* shell = ash::Shell::GetInstance();
419 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow()); 420 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow());
420 DragAlongShelfReorder(0, -1); 421 DragAlongShelfReorder(0, -1);
421 } 422 }
422 423
423 } // namespace internal 424 } // namespace internal
424 } // namespace ash 425 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698