| 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/layout_constants.h" | 9 #include "chrome/browser/ui/layout_constants.h" |
| 10 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" | 10 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 EXPECT_TRUE(tab_strip_->tab_at(invisible_tab_index - 1)->visible()); | 275 EXPECT_TRUE(tab_strip_->tab_at(invisible_tab_index - 1)->visible()); |
| 276 EXPECT_FALSE(tab_strip_->tab_at(invisible_tab_index)->visible()); | 276 EXPECT_FALSE(tab_strip_->tab_at(invisible_tab_index)->visible()); |
| 277 | 277 |
| 278 // If we remove enough tabs, all the tabs should be visible. | 278 // If we remove enough tabs, all the tabs should be visible. |
| 279 for (int i = tab_strip_->tab_count() - 1; i >= invisible_tab_index; --i) | 279 for (int i = tab_strip_->tab_count() - 1; i >= invisible_tab_index; --i) |
| 280 controller_->RemoveTab(i); | 280 controller_->RemoveTab(i); |
| 281 EXPECT_TRUE(tab_strip_->tab_at(tab_strip_->tab_count() - 1)->visible()); | 281 EXPECT_TRUE(tab_strip_->tab_at(tab_strip_->tab_count() - 1)->visible()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST_F(TabStripTest, ImmersiveMode) { | 284 TEST_F(TabStripTest, ImmersiveMode) { |
| 285 // Immersive mode defaults to off. | |
| 286 EXPECT_FALSE(tab_strip_->IsImmersiveStyle()); | |
| 287 | |
| 288 // Tab strip defaults to normal tab height. | 285 // Tab strip defaults to normal tab height. |
| 289 int normal_height = Tab::GetMinimumInactiveSize().height(); | 286 int normal_height = Tab::GetMinimumInactiveSize().height(); |
| 290 EXPECT_EQ(normal_height, tab_strip_->GetPreferredSize().height()); | 287 EXPECT_EQ(normal_height, tab_strip_->GetPreferredSize().height()); |
| 291 | 288 |
| 292 // Tab strip can toggle immersive mode. | 289 // Tab strip can toggle immersive mode by setting to offscreen. |
| 293 tab_strip_->SetImmersiveStyle(true); | 290 tab_strip_->set_offscreen(true); |
| 294 EXPECT_TRUE(tab_strip_->IsImmersiveStyle()); | |
| 295 | 291 |
| 296 // Now tabs have the immersive height. | 292 // Now tabs have the height zero. |
| 297 int immersive_height = Tab::GetImmersiveHeight(); | 293 EXPECT_EQ(0, tab_strip_->GetPreferredSize().height()); |
| 298 EXPECT_EQ(immersive_height, tab_strip_->GetPreferredSize().height()); | |
| 299 | |
| 300 // Sanity-check immersive tabs are shorter than normal tabs. | |
| 301 EXPECT_LT(immersive_height, normal_height); | |
| 302 } | 294 } |
| 303 | 295 |
| 304 // Creates a tab strip in stacked layout mode and verifies that as we move | 296 // Creates a tab strip in stacked layout mode and verifies that as we move |
| 305 // across the strip at the top, middle, and bottom, events will target each tab | 297 // across the strip at the top, middle, and bottom, events will target each tab |
| 306 // in order. | 298 // in order. |
| 307 TEST_F(TabStripTest, TabForEventWhenStacked) { | 299 TEST_F(TabStripTest, TabForEventWhenStacked) { |
| 308 tab_strip_->SetBounds(0, 0, 200, GetLayoutConstant(TAB_HEIGHT)); | 300 tab_strip_->SetBounds(0, 0, 200, GetLayoutConstant(TAB_HEIGHT)); |
| 309 | 301 |
| 310 controller_->AddTab(0, false); | 302 controller_->AddTab(0, false); |
| 311 controller_->AddTab(1, true); | 303 controller_->AddTab(1, true); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 550 |
| 559 // Change the title of the second tab (first tab is selected). | 551 // Change the title of the second tab (first tab is selected). |
| 560 tab_strip_->TabTitleChangedNotLoading(1); | 552 tab_strip_->TabTitleChangedNotLoading(1); |
| 561 // Indicator should be shown. | 553 // Indicator should be shown. |
| 562 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1)); | 554 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1)); |
| 563 // Select the second tab. | 555 // Select the second tab. |
| 564 controller_->SelectTab(1); | 556 controller_->SelectTab(1); |
| 565 // Indicator should hide. | 557 // Indicator should hide. |
| 566 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1)); | 558 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1)); |
| 567 } | 559 } |
| OLD | NEW |