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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 | 1755 |
1756 class ButtonDropDownTest : public ViewTest { | 1756 class ButtonDropDownTest : public ViewTest { |
1757 public: | 1757 public: |
1758 ButtonDropDownTest() | 1758 ButtonDropDownTest() |
1759 : test_dialog_(NULL), | 1759 : test_dialog_(NULL), |
1760 button_as_view_(NULL) { | 1760 button_as_view_(NULL) { |
1761 } | 1761 } |
1762 | 1762 |
1763 virtual void SetUp() OVERRIDE { | 1763 virtual void SetUp() OVERRIDE { |
1764 ViewTest::SetUp(); | 1764 ViewTest::SetUp(); |
1765 test_dialog_ = new TestDialog(&mock_menu_model_); | 1765 test_dialog_ = new TestDialog(new MockMenuModel()); |
1766 Widget* window = | 1766 Widget* window = |
1767 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); | 1767 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); |
1768 test_dialog_->widget_ = window; | 1768 test_dialog_->widget_ = window; |
1769 window->Show(); | 1769 window->Show(); |
1770 test_dialog_->button_drop_->SetBoundsRect(gfx::Rect(0, 0, 100, 100)); | 1770 test_dialog_->button_drop_->SetBoundsRect(gfx::Rect(0, 0, 100, 100)); |
1771 // We have to cast the button back into a View in order to invoke it's | 1771 // We have to cast the button back into a View in order to invoke it's |
1772 // OnMouseReleased method. | 1772 // OnMouseReleased method. |
1773 button_as_view_ = static_cast<View*>(test_dialog_->button_drop_); | 1773 button_as_view_ = static_cast<View*>(test_dialog_->button_drop_); |
1774 } | 1774 } |
1775 | 1775 |
1776 virtual void TearDown() OVERRIDE { | 1776 virtual void TearDown() OVERRIDE { |
1777 test_dialog_->TearDown(); | 1777 test_dialog_->TearDown(); |
1778 ViewTest::TearDown(); | 1778 ViewTest::TearDown(); |
1779 } | 1779 } |
1780 | 1780 |
1781 TestDialog* test_dialog_; | 1781 TestDialog* test_dialog_; |
1782 MockMenuModel mock_menu_model_; | |
1783 // This is owned by test_dialog_. | 1782 // This is owned by test_dialog_. |
1784 View* button_as_view_; | 1783 View* button_as_view_; |
1785 | 1784 |
1786 private: | 1785 private: |
1787 DISALLOW_COPY_AND_ASSIGN(ButtonDropDownTest); | 1786 DISALLOW_COPY_AND_ASSIGN(ButtonDropDownTest); |
1788 }; | 1787 }; |
1789 | 1788 |
1790 // Ensure that regular clicks on the drop down button still work. (i.e. - the | 1789 // Ensure that regular clicks on the drop down button still work. (i.e. - the |
1791 // click events are processed and the listener gets the click) | 1790 // click events are processed and the listener gets the click) |
1792 TEST_F(ButtonDropDownTest, RegularClickTest) { | 1791 TEST_F(ButtonDropDownTest, RegularClickTest) { |
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 // Set to non default value. | 3336 // Set to non default value. |
3338 v->layer()->set_scale_content(false); | 3337 v->layer()->set_scale_content(false); |
3339 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); | 3338 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); |
3340 ui::Layer* new_layer = v->layer(); | 3339 ui::Layer* new_layer = v->layer(); |
3341 EXPECT_FALSE(new_layer->scale_content()); | 3340 EXPECT_FALSE(new_layer->scale_content()); |
3342 } | 3341 } |
3343 | 3342 |
3344 #endif // USE_AURA | 3343 #endif // USE_AURA |
3345 | 3344 |
3346 } // namespace views | 3345 } // namespace views |
OLD | NEW |