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

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 15931005: Move bezel event routing for the shelf into ShelfLayoutManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed failing test after discussing with sadrul Created 7 years, 6 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/shelf/shelf_layout_manager.cc ('k') | ash/wm/gestures/border_gesture_handler.h » ('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/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); 463 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
464 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); 464 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
465 EXPECT_EQ(shelf_hidden.ToString(), 465 EXPECT_EQ(shelf_hidden.ToString(),
466 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); 466 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
467 467
468 // Swipe up outside the hit area. This should not change anything. 468 // Swipe up outside the hit area. This should not change anything.
469 gfx::Point outside_start = gfx::Point( 469 gfx::Point outside_start = gfx::Point(
470 (GetShelfWidget()->GetWindowBoundsInScreen().x() + 470 (GetShelfWidget()->GetWindowBoundsInScreen().x() +
471 GetShelfWidget()->GetWindowBoundsInScreen().right())/2, 471 GetShelfWidget()->GetWindowBoundsInScreen().right())/2,
472 GetShelfWidget()->GetWindowBoundsInScreen().y() - 50); 472 GetShelfWidget()->GetWindowBoundsInScreen().y() - 50);
473 end.set_y(outside_start.y() - 100); 473 end = outside_start + delta;
474 generator.GestureScrollSequence(outside_start, 474 generator.GestureScrollSequence(outside_start,
475 end, 475 end,
476 base::TimeDelta::FromMilliseconds(10), 476 base::TimeDelta::FromMilliseconds(10),
477 kNumScrollSteps); 477 kNumScrollSteps);
478 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); 478 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
479 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 479 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
480 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 480 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
481 EXPECT_EQ(shelf_hidden.ToString(), 481 EXPECT_EQ(shelf_hidden.ToString(),
482 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); 482 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
483 483
484 // Swipe up from below the shelf where a bezel would be, this should show the
485 // shelf.
486 gfx::Point below_start = start;
487 if (GetShelfLayoutManager()->IsHorizontalAlignment())
488 below_start.set_y(GetShelfWidget()->GetWindowBoundsInScreen().bottom() + 1);
489 else if (SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
490 below_start.set_x(
491 GetShelfWidget()->GetWindowBoundsInScreen().x() - 1);
492 else if (SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
493 below_start.set_x(GetShelfWidget()->GetWindowBoundsInScreen().right() + 1);
494 end = below_start - delta;
495 generator.GestureScrollSequence(below_start,
496 end,
497 base::TimeDelta::FromMilliseconds(10),
498 kNumScrollSteps);
499 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
500 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior());
501 EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString());
502 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(),
503 GetShelfWidget()->GetWindowBoundsInScreen());
504 EXPECT_EQ(shelf_shown.ToString(),
505 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
506
507 // Swipe down again to hide.
508 end = start + delta;
509 generator.GestureScrollSequenceWithCallback(start, end,
510 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps,
511 base::Bind(&ShelfDragCallback::ProcessScroll,
512 base::Unretained(&handler)));
513 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
514 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
515 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
516 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect());
517 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString());
518 EXPECT_EQ(shelf_hidden.ToString(),
519 GetShelfWidget()->GetWindowBoundsInScreen().ToString());
520
484 // Make the window fullscreen. 521 // Make the window fullscreen.
485 widget->SetFullscreen(true); 522 widget->SetFullscreen(true);
486 gfx::Rect bounds_fullscreen = window->bounds(); 523 gfx::Rect bounds_fullscreen = window->bounds();
487 EXPECT_TRUE(widget->IsFullscreen()); 524 EXPECT_TRUE(widget->IsFullscreen());
488 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); 525 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString());
489 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 526 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
527 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
490 528
491 // Swipe-up. This should not change anything. 529 // Swipe-up. This should not change anything.
530 end = start - delta;
492 generator.GestureScrollSequenceWithCallback(end, start, 531 generator.GestureScrollSequenceWithCallback(end, start,
493 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, 532 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps,
494 base::Bind(&ShelfDragCallback::ProcessScroll, 533 base::Bind(&ShelfDragCallback::ProcessScroll,
495 base::Unretained(&handler))); 534 base::Unretained(&handler)));
496 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); 535 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
497 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); 536 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior());
498 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); 537 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString());
499 538
500 widget->Close(); 539 widget->Close();
501 } 540 }
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); 1470 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
1432 } else { 1471 } else {
1433 EXPECT_FALSE(shelf->IsVisible()); 1472 EXPECT_FALSE(shelf->IsVisible());
1434 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); 1473 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
1435 } 1474 }
1436 } 1475 }
1437 } 1476 }
1438 1477
1439 } // namespace internal 1478 } // namespace internal
1440 } // namespace ash 1479 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/wm/gestures/border_gesture_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698