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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip_unittest.cc

Issue 1566313002: Remove layout during paint in Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: With sky's changes to fake controller Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip_unittest.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
index 5cab4639827c186b56d37943e1595f525d1f5bb2..9c5d4d6f149388792ada995278b6466c20b2cd8d 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
@@ -125,16 +125,6 @@ class TabStripTest : public views::ViewsTestBase {
views::ViewsTestBase::TearDown();
}
- // Forces a call to OnPaint() for each tab in |tab_strip_| in order to
- // trigger a layout, which is needed to update the visibility of tab
- // close buttons after a tab switch or close. Note that painting does
- // not occur in unit tests, which is why this helper is used.
- void TriggerPaintOfAllTabs() {
- gfx::Canvas canvas;
- for (int i = 0; i < tab_strip_->tab_count(); ++i)
- tab_strip_->tab_at(i)->OnPaint(&canvas);
- }
-
protected:
// Returns the rectangular hit test region of |tab| in |tab|'s local
// coordinate space.
@@ -442,7 +432,6 @@ TEST_F(TabStripTest, TabCloseButtonVisibilityWhenStacked) {
Tab* tab2 = tab_strip_->tab_at(2);
// Ensure that all tab close buttons are initially visible.
- TriggerPaintOfAllTabs();
EXPECT_TRUE(tab0->showing_close_button_);
EXPECT_TRUE(tab1->showing_close_button_);
EXPECT_TRUE(tab2->showing_close_button_);
@@ -450,7 +439,6 @@ TEST_F(TabStripTest, TabCloseButtonVisibilityWhenStacked) {
// Enter stacked layout mode and verify this sets |touch_layout_|.
ASSERT_FALSE(tab_strip_->touch_layout_.get());
tab_strip_->SetStackedLayout(true);
- TriggerPaintOfAllTabs();
ASSERT_TRUE(tab_strip_->touch_layout_.get());
// Only the close button of the active tab should be visible in stacked
@@ -472,7 +460,6 @@ TEST_F(TabStripTest, TabCloseButtonVisibilityWhenStacked) {
// tab close button hidden and the newly-active tab should show
// its tab close button.
tab_strip_->SelectTab(tab2);
- TriggerPaintOfAllTabs();
ASSERT_FALSE(tab1->IsActive());
ASSERT_TRUE(tab2->IsActive());
EXPECT_FALSE(tab0->showing_close_button_);
@@ -485,14 +472,12 @@ TEST_F(TabStripTest, TabCloseButtonVisibilityWhenStacked) {
tab_strip_->CloseTab(tab1, CLOSE_TAB_FROM_TOUCH);
tab1 = nullptr;
ASSERT_TRUE(tab2->IsActive());
- TriggerPaintOfAllTabs();
EXPECT_FALSE(tab0->showing_close_button_);
EXPECT_TRUE(tab2->showing_close_button_);
EXPECT_FALSE(tab3->showing_close_button_);
// All tab close buttons should be shown when disengaging stacked tab mode.
tab_strip_->SetStackedLayout(false);
- TriggerPaintOfAllTabs();
ASSERT_FALSE(tab_strip_->touch_layout_.get());
EXPECT_TRUE(tab0->showing_close_button_);
EXPECT_TRUE(tab2->showing_close_button_);
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698