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

Side by Side Diff: ash/launcher/launcher_view_unittest.cc

Issue 22291003: ash:Shelf Update Alternate Layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nl Created 7 years, 4 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/launcher/launcher_view.cc ('k') | ash/launcher/overflow_bubble.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/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/launcher/launcher.h" 11 #include "ash/launcher/launcher.h"
12 #include "ash/launcher/launcher_button.h" 12 #include "ash/launcher/launcher_button.h"
13 #include "ash/launcher/launcher_icon_observer.h" 13 #include "ash/launcher/launcher_icon_observer.h"
14 #include "ash/launcher/launcher_model.h" 14 #include "ash/launcher/launcher_model.h"
15 #include "ash/launcher/launcher_tooltip_manager.h" 15 #include "ash/launcher/launcher_tooltip_manager.h"
16 #include "ash/launcher/launcher_types.h"
16 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
17 #include "ash/shelf/shelf_layout_manager.h" 18 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shelf/shelf_widget.h" 19 #include "ash/shelf/shelf_widget.h"
19 #include "ash/shell.h" 20 #include "ash/shell.h"
20 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
21 #include "ash/test/ash_test_base.h" 22 #include "ash/test/ash_test_base.h"
22 #include "ash/test/launcher_view_test_api.h" 23 #include "ash/test/launcher_view_test_api.h"
23 #include "ash/test/shell_test_api.h" 24 #include "ash/test/shell_test_api.h"
24 #include "ash/test/test_launcher_delegate.h" 25 #include "ash/test/test_launcher_delegate.h"
25 #include "base/basictypes.h" 26 #include "base/basictypes.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 gfx::Point icon_offset = button->GetIconBounds().origin(); 429 gfx::Point icon_offset = button->GetIconBounds().origin();
429 item_bounds.Offset(icon_offset.OffsetFromOrigin()); 430 item_bounds.Offset(icon_offset.OffsetFromOrigin());
430 gfx::Rect ideal_bounds = launcher_view_->GetIdealBoundsOfItemIcon(id); 431 gfx::Rect ideal_bounds = launcher_view_->GetIdealBoundsOfItemIcon(id);
431 gfx::Point screen_origin; 432 gfx::Point screen_origin;
432 views::View::ConvertPointToScreen(launcher_view_, &screen_origin); 433 views::View::ConvertPointToScreen(launcher_view_, &screen_origin);
433 ideal_bounds.Offset(screen_origin.x(), screen_origin.y()); 434 ideal_bounds.Offset(screen_origin.x(), screen_origin.y());
434 EXPECT_EQ(item_bounds.x(), ideal_bounds.x()); 435 EXPECT_EQ(item_bounds.x(), ideal_bounds.x());
435 EXPECT_EQ(item_bounds.y(), ideal_bounds.y()); 436 EXPECT_EQ(item_bounds.y(), ideal_bounds.y());
436 } 437 }
437 438
439 // Checks that launcher view contents are considered in the correct drag group.
440 TEST_F(LauncherViewTest, EnforceDragType) {
441 EXPECT_TRUE(test_api_->SameDragType(TYPE_TABBED, TYPE_TABBED));
442 EXPECT_TRUE(test_api_->SameDragType(TYPE_TABBED, TYPE_PLATFORM_APP));
443 EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_SHORTCUT));
444 EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_BROWSER_SHORTCUT));
445 EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_WINDOWED_APP));
446 EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_LIST));
447 EXPECT_FALSE(test_api_->SameDragType(TYPE_TABBED, TYPE_APP_PANEL));
448
449 EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP));
450 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT));
451 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP,
452 TYPE_BROWSER_SHORTCUT));
453 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP));
454 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST));
455 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL));
456
457 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_SHORTCUT));
458 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT,
459 TYPE_BROWSER_SHORTCUT));
460 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT,
461 TYPE_WINDOWED_APP));
462 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_LIST));
463 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_PANEL));
464
465 EXPECT_TRUE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT,
466 TYPE_BROWSER_SHORTCUT));
467 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT,
468 TYPE_WINDOWED_APP));
469 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_LIST));
470 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_PANEL));
471
472 EXPECT_TRUE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_WINDOWED_APP));
473 EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_LIST));
474 EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_PANEL));
475
476 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_LIST));
477 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_PANEL));
478
479 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_PANEL, TYPE_APP_PANEL));
480 }
481
438 // Adds browser button until overflow and verifies that the last added browser 482 // Adds browser button until overflow and verifies that the last added browser
439 // button is hidden. 483 // button is hidden.
440 TEST_F(LauncherViewTest, AddBrowserUntilOverflow) { 484 TEST_F(LauncherViewTest, AddBrowserUntilOverflow) {
441 // All buttons should be visible. 485 // All buttons should be visible.
442 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, 486 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
443 test_api_->GetButtonCount()); 487 test_api_->GetButtonCount());
444 488
445 // Add tabbed browser until overflow. 489 // Add tabbed browser until overflow.
446 int items_added = 0; 490 int items_added = 0;
447 LauncherID last_added = AddTabbedBrowser(); 491 LauncherID last_added = AddTabbedBrowser();
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 test_api_->GetButtonCount()); 1097 test_api_->GetButtonCount());
1054 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); 1098 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0);
1055 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); 1099 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1);
1056 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); 1100 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width());
1057 } 1101 }
1058 1102
1059 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool()); 1103 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool());
1060 1104
1061 } // namespace test 1105 } // namespace test
1062 } // namespace ash 1106 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view.cc ('k') | ash/launcher/overflow_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698