| 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/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" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 class TabStripTest : public testing::Test { | 13 class TabStripTest : public testing::Test { |
| 14 public: | 14 public: |
| 15 TabStripTest() | 15 TabStripTest() |
| 16 : controller_(new FakeBaseTabStripController), | 16 : controller_(new FakeBaseTabStripController), |
| 17 tab_strip_(new TabStrip(controller_)) { | 17 tab_strip_(new TabStrip(controller_, false)) { |
| 18 controller_->set_tab_strip(tab_strip_); | 18 controller_->set_tab_strip(tab_strip_); |
| 19 // Do this to force TabStrip to create the buttons. | 19 // Do this to force TabStrip to create the buttons. |
| 20 parent_.AddChildView(tab_strip_); | 20 parent_.AddChildView(tab_strip_); |
| 21 } | 21 } |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 MessageLoopForUI ui_loop_; | 24 MessageLoopForUI ui_loop_; |
| 25 // Owned by TabStrip. | 25 // Owned by TabStrip. |
| 26 FakeBaseTabStripController* controller_; | 26 FakeBaseTabStripController* controller_; |
| 27 // Owns |tab_strip_|. | 27 // Owns |tab_strip_|. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |