| OLD | NEW |
| 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/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Add panels until there is an overflow. | 528 // Add panels until there is an overflow. |
| 529 LauncherID last_panel = first_panel; | 529 LauncherID last_panel = first_panel; |
| 530 int items_added = 0; | 530 int items_added = 0; |
| 531 while (!test_api_->IsOverflowButtonVisible()) { | 531 while (!test_api_->IsOverflowButtonVisible()) { |
| 532 last_panel = AddPanel(); | 532 last_panel = AddPanel(); |
| 533 ++items_added; | 533 ++items_added; |
| 534 ASSERT_LT(items_added, 10000); | 534 ASSERT_LT(items_added, 10000); |
| 535 } | 535 } |
| 536 | 536 |
| 537 // The first panel should now be hidden by the new browsers needing space. | 537 // The first panel should now be hidden by the new browsers needing space. |
| 538 EXPECT_FALSE(GetButtonByID(first_panel)->visible()); | 538 EXPECT_TRUE(GetButtonByID(first_panel)->visible()); |
| 539 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); | 539 EXPECT_FALSE(GetButtonByID(last_panel)->visible()); |
| 540 EXPECT_TRUE(GetButtonByID(browser)->visible()); | 540 EXPECT_TRUE(GetButtonByID(browser)->visible()); |
| 541 | 541 |
| 542 // Adding browsers should eventually begin to hide browsers. We will add | 542 // Adding browsers should eventually begin to hide browsers. We will add |
| 543 // browsers until either the last panel or browser is hidden. | 543 // browsers until either the last panel or browser is hidden. |
| 544 items_added = 0; | 544 items_added = 0; |
| 545 while (GetButtonByID(browser)->visible() && | 545 while (GetButtonByID(browser)->visible() && |
| 546 GetButtonByID(last_panel)->visible()) { | 546 GetButtonByID(first_panel)->visible()) { |
| 547 browser = AddTabbedBrowser(); | 547 browser = AddTabbedBrowser(); |
| 548 ++items_added; | 548 ++items_added; |
| 549 ASSERT_LT(items_added, 10000); | 549 ASSERT_LT(items_added, 10000); |
| 550 } | 550 } |
| 551 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); | 551 EXPECT_TRUE(GetButtonByID(first_panel)->visible()); |
| 552 EXPECT_FALSE(GetButtonByID(browser)->visible()); | 552 EXPECT_FALSE(GetButtonByID(browser)->visible()); |
| 553 } | 553 } |
| 554 | 554 |
| 555 // Adds button until overflow then removes first added one. Verifies that | 555 // Adds button until overflow then removes first added one. Verifies that |
| 556 // the last added one changes from invisible to visible and overflow | 556 // the last added one changes from invisible to visible and overflow |
| 557 // chevron is gone. | 557 // chevron is gone. |
| 558 TEST_F(LauncherViewTest, RemoveButtonRevealsOverflowed) { | 558 TEST_F(LauncherViewTest, RemoveButtonRevealsOverflowed) { |
| 559 // All buttons should be visible. | 559 // All buttons should be visible. |
| 560 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, | 560 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, |
| 561 test_api_->GetButtonCount()); | 561 test_api_->GetButtonCount()); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 test_api_->GetButtonCount()); | 1006 test_api_->GetButtonCount()); |
| 1007 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); | 1007 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); |
| 1008 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); | 1008 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); |
| 1009 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); | 1009 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool()); | 1012 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool()); |
| 1013 | 1013 |
| 1014 } // namespace test | 1014 } // namespace test |
| 1015 } // namespace ash | 1015 } // namespace ash |
| OLD | NEW |