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

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

Issue 10213011: Attempt 3 at a better touch tabstrip. There is still a bunch to do, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Tab::GetTouchModeMinimumSize Created 8 years, 7 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 | Annotate | Revision Log
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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" 8 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h"
9 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" 9 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
10 #include "chrome/browser/ui/views/tabs/tab_strip.h" 10 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 TEST_F(TabStripTest, tab_count) { 43 TEST_F(TabStripTest, tab_count) {
44 EXPECT_EQ(0, tab_strip_->tab_count()); 44 EXPECT_EQ(0, tab_strip_->tab_count());
45 } 45 }
46 46
47 TEST_F(TabStripTest, CreateTabForDragging) { 47 TEST_F(TabStripTest, CreateTabForDragging) {
48 // Any result is good, as long as it doesn't crash. 48 // Any result is good, as long as it doesn't crash.
49 scoped_ptr<BaseTab> tab(tab_strip_->CreateTabForDragging()); 49 scoped_ptr<BaseTab> tab(tab_strip_->CreateTabForDragging());
50 } 50 }
51 51
52 TEST_F(TabStripTest, AddTabAt) { 52 TEST_F(TabStripTest, AddTabAt) {
53 tab_strip_->AddTabAt(0, TabRendererData()); 53 tab_strip_->AddTabAt(0, TabRendererData(), false);
54 ASSERT_EQ(1, tab_strip_->tab_count()); 54 ASSERT_EQ(1, tab_strip_->tab_count());
55 Tab* tab = tab_strip_->tab_at(0); 55 Tab* tab = tab_strip_->tab_at(0);
56 EXPECT_FALSE(tab == NULL); 56 EXPECT_FALSE(tab == NULL);
57 } 57 }
58 58
59 // Verifies child views are deleted after an animation completes. 59 // Verifies child views are deleted after an animation completes.
60 TEST_F(TabStripTest, RemoveTab) { 60 TEST_F(TabStripTest, RemoveTab) {
61 controller_->AddTab(0); 61 controller_->AddTab(0);
62 controller_->AddTab(1); 62 controller_->AddTab(1);
63 const int child_view_count = tab_strip_->child_count(); 63 const int child_view_count = tab_strip_->child_count();
64 EXPECT_EQ(2, tab_strip_->tab_count()); 64 EXPECT_EQ(2, tab_strip_->tab_count());
65 controller_->RemoveTab(0); 65 controller_->RemoveTab(0);
66 // When removing a tab the tabcount should immediately decrement. 66 // When removing a tab the tabcount should immediately decrement.
67 EXPECT_EQ(1, tab_strip_->tab_count()); 67 EXPECT_EQ(1, tab_strip_->tab_count());
68 // But the number of views should remain the same (it's animatining closed). 68 // But the number of views should remain the same (it's animatining closed).
69 EXPECT_EQ(child_view_count, tab_strip_->child_count()); 69 EXPECT_EQ(child_view_count, tab_strip_->child_count());
70 tab_strip_->SetBounds(0, 0, 200, 20); 70 tab_strip_->SetBounds(0, 0, 200, 20);
71 // Layout at a different size should force the animation to end and delete 71 // Layout at a different size should force the animation to end and delete
72 // the tab that was removed. 72 // the tab that was removed.
73 tab_strip_->Layout(); 73 tab_strip_->Layout();
74 EXPECT_EQ(child_view_count - 1, tab_strip_->child_count()); 74 EXPECT_EQ(child_view_count - 1, tab_strip_->child_count());
75 75
76 // Remove the last tab to make sure things are cleaned up correctly when 76 // Remove the last tab to make sure things are cleaned up correctly when
77 // the TabStrip is destroyed and an animation is ongoing. 77 // the TabStrip is destroyed and an animation is ongoing.
78 controller_->RemoveTab(0); 78 controller_->RemoveTab(0);
79 } 79 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/views/tabs/touch_tab_strip_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698