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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip_unittest.cc

Issue 2368653002: Remove pre-MD code from browser/ui/views/tabs/tab.cc (Closed)
Patch Set: fix compile Created 4 years, 2 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
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 "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"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 controller_->AddTab(0, false); 299 controller_->AddTab(0, false);
300 EXPECT_TRUE(tab_strip_->tab_at(invisible_tab_index - 1)->visible()); 300 EXPECT_TRUE(tab_strip_->tab_at(invisible_tab_index - 1)->visible());
301 EXPECT_FALSE(tab_strip_->tab_at(invisible_tab_index)->visible()); 301 EXPECT_FALSE(tab_strip_->tab_at(invisible_tab_index)->visible());
302 302
303 // If we remove enough tabs, all the tabs should be visible. 303 // If we remove enough tabs, all the tabs should be visible.
304 for (int i = tab_strip_->tab_count() - 1; i >= invisible_tab_index; --i) 304 for (int i = tab_strip_->tab_count() - 1; i >= invisible_tab_index; --i)
305 controller_->RemoveTab(i); 305 controller_->RemoveTab(i);
306 EXPECT_TRUE(tab_strip_->tab_at(tab_strip_->tab_count() - 1)->visible()); 306 EXPECT_TRUE(tab_strip_->tab_at(tab_strip_->tab_count() - 1)->visible());
307 } 307 }
308 308
309 TEST_F(TabStripTest, ImmersiveMode) {
310 // Immersive mode defaults to off.
311 EXPECT_FALSE(tab_strip_->IsImmersiveStyle());
312
313 // Tab strip defaults to normal tab height.
314 int normal_height = Tab::GetMinimumInactiveSize().height();
315 EXPECT_EQ(normal_height, tab_strip_->GetPreferredSize().height());
316
317 // Tab strip can toggle immersive mode.
318 tab_strip_->SetImmersiveStyle(true);
319 EXPECT_TRUE(tab_strip_->IsImmersiveStyle());
320
321 // Now tabs have the immersive height.
322 int immersive_height = Tab::GetImmersiveHeight();
323 EXPECT_EQ(immersive_height, tab_strip_->GetPreferredSize().height());
324
325 // Sanity-check immersive tabs are shorter than normal tabs.
326 EXPECT_LT(immersive_height, normal_height);
327 }
328
329 // Creates a tab strip in stacked layout mode and verifies the correctness 309 // Creates a tab strip in stacked layout mode and verifies the correctness
330 // of hit tests against the visible/occluded regions of a tab and the tab 310 // of hit tests against the visible/occluded regions of a tab and the tab
331 // close button of the active tab. 311 // close button of the active tab.
332 TEST_F(TabStripTest, TabHitTestMaskWhenStacked) { 312 TEST_F(TabStripTest, TabHitTestMaskWhenStacked) {
333 // TODO(varkha,pkasting): Update the test for Material Design layout. 313 // TODO(varkha,pkasting): Update the test for Material Design layout.
334 // crbug.com/575327 314 // crbug.com/575327
335 if (ui::MaterialDesignController::IsModeMaterial()) { 315 if (ui::MaterialDesignController::IsModeMaterial()) {
336 VLOG(1) << "Test is DISABLED for material design layouts."; 316 VLOG(1) << "Test is DISABLED for material design layouts.";
337 return; 317 return;
338 } 318 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 637
658 // Change the title of the second tab (first tab is selected). 638 // Change the title of the second tab (first tab is selected).
659 tab_strip_->TabTitleChangedNotLoading(1); 639 tab_strip_->TabTitleChangedNotLoading(1);
660 // Indicator should be shown. 640 // Indicator should be shown.
661 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1)); 641 EXPECT_TRUE(IsShowingPinnedTabTitleChangedIndicator(1));
662 // Select the second tab. 642 // Select the second tab.
663 controller_->SelectTab(1); 643 controller_->SelectTab(1);
664 // Indicator should hide. 644 // Indicator should hide.
665 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1)); 645 EXPECT_FALSE(IsShowingPinnedTabTitleChangedIndicator(1));
666 } 646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698