| 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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" | 9 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" |
| 10 #include "chrome/browser/ui/views/tabs/tab.h" | 10 #include "chrome/browser/ui/views/tabs/tab.h" |
| 11 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
| 11 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 12 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 12 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 13 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
| 13 #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" | 14 #include "chrome/browser/ui/views/tabs/tab_strip_observer.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/base/material_design/material_design_controller.h" | 17 #include "ui/base/material_design/material_design_controller.h" |
| 17 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
| 18 #include "ui/gfx/geometry/rect_conversions.h" | 19 #include "ui/gfx/geometry/rect_conversions.h" |
| 19 #include "ui/gfx/path.h" | 20 #include "ui/gfx/path.h" |
| 20 #include "ui/gfx/skia_util.h" | 21 #include "ui/gfx/skia_util.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 const int kTabStripWidth = 500; | 629 const int kTabStripWidth = 500; |
| 629 tab_strip_->SetBounds(0, 0, kTabStripWidth, 20); | 630 tab_strip_->SetBounds(0, 0, kTabStripWidth, 20); |
| 630 | 631 |
| 631 for (int i = 0; i < 100; ++i) | 632 for (int i = 0; i < 100; ++i) |
| 632 controller_->AddTab(i, (i == 0)); | 633 controller_->AddTab(i, (i == 0)); |
| 633 | 634 |
| 634 DoLayout(); | 635 DoLayout(); |
| 635 | 636 |
| 636 EXPECT_LE(tab_strip_->GetNewTabButtonBounds().right(), kTabStripWidth); | 637 EXPECT_LE(tab_strip_->GetNewTabButtonBounds().right(), kTabStripWidth); |
| 637 } | 638 } |
| 639 |
| 640 TEST_F(TabStripTest, PinnedTabTitleChangedIndicatorHidesOnSelect) { |
| 641 for (int i = 0; i < 2; ++i) |
| 642 controller_->AddTab(i, (i == 0)); |
| 643 |
| 644 // Two tabs, both pinned. |
| 645 TabRendererData pinned_data; |
| 646 pinned_data.pinned = true; |
| 647 tab_strip_->SetTabData(0, pinned_data); |
| 648 tab_strip_->SetTabData(1, pinned_data); |
| 649 |
| 650 EXPECT_FALSE( |
| 651 tab_strip_->tab_at(0)->showing_pinned_tab_title_changed_indicator()); |
| 652 EXPECT_FALSE( |
| 653 tab_strip_->tab_at(1)->showing_pinned_tab_title_changed_indicator()); |
| 654 |
| 655 // Change the title of the second tab (first tab is selected). |
| 656 tab_strip_->TabTitleChangedNotLoading(1); |
| 657 // Indicator should be shown. |
| 658 EXPECT_TRUE( |
| 659 tab_strip_->tab_at(1)->showing_pinned_tab_title_changed_indicator()); |
| 660 // Select the second tab. |
| 661 controller_->SelectTab(1); |
| 662 // Indicator should hide. |
| 663 EXPECT_FALSE( |
| 664 tab_strip_->tab_at(1)->showing_pinned_tab_title_changed_indicator()); |
| 665 } |
| OLD | NEW |