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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 controller_->AddTab(0, false); | 274 controller_->AddTab(0, false); |
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) { | |
285 // Immersive mode defaults to off. | |
286 EXPECT_FALSE(tab_strip_->IsImmersiveStyle()); | |
287 | |
288 // Tab strip defaults to normal tab height. | |
289 int normal_height = Tab::GetMinimumInactiveSize().height(); | |
290 EXPECT_EQ(normal_height, tab_strip_->GetPreferredSize().height()); | |
291 | |
292 // Tab strip can toggle immersive mode. | |
293 tab_strip_->SetImmersiveStyle(true); | |
294 EXPECT_TRUE(tab_strip_->IsImmersiveStyle()); | |
295 | |
296 // Now tabs have the immersive height. | |
297 int immersive_height = Tab::GetImmersiveHeight(); | |
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 } | |
303 | |
304 // Creates a tab strip in stacked layout mode and verifies that as we move | 284 // 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 | 285 // across the strip at the top, middle, and bottom, events will target each tab |
306 // in order. | 286 // in order. |
307 TEST_F(TabStripTest, TabForEventWhenStacked) { | 287 TEST_F(TabStripTest, TabForEventWhenStacked) { |
308 tab_strip_->SetBounds(0, 0, 200, GetLayoutConstant(TAB_HEIGHT)); | 288 tab_strip_->SetBounds(0, 0, 200, GetLayoutConstant(TAB_HEIGHT)); |
309 | 289 |
310 controller_->AddTab(0, false); | 290 controller_->AddTab(0, false); |
311 controller_->AddTab(1, true); | 291 controller_->AddTab(1, true); |
312 controller_->AddTab(2, false); | 292 controller_->AddTab(2, false); |
313 controller_->AddTab(3, false); | 293 controller_->AddTab(3, false); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 538 |
559 // Change the title of the second tab (first tab is selected). | 539 // Change the title of the second tab (first tab is selected). |
560 tab_strip_->TabTitleChangedNotLoading(1); | 540 tab_strip_->TabTitleChangedNotLoading(1); |
561 // Indicator should be shown. | 541 // Indicator should be shown. |
562 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1)); | 542 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1)); |
563 // Select the second tab. | 543 // Select the second tab. |
564 controller_->SelectTab(1); | 544 controller_->SelectTab(1); |
565 // Indicator should hide. | 545 // Indicator should hide. |
566 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1)); | 546 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1)); |
567 } | 547 } |
OLD | NEW |