| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef UI_VIEWS_TEST_TEST_VIEWS_H_ | 5 #ifndef UI_VIEWS_TEST_TEST_VIEWS_H_ |
| 6 #define UI_VIEWS_TEST_TEST_VIEWS_H_ | 6 #define UI_VIEWS_TEST_TEST_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/events/event_constants.h" | 11 #include "ui/events/event_constants.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 // A view that requests a set amount of space. | 16 // A view that requests a set amount of space. |
| 17 class StaticSizedView : public View { | 17 class StaticSizedView : public View { |
| 18 public: | 18 public: |
| 19 explicit StaticSizedView(const gfx::Size& size); | 19 explicit StaticSizedView(const gfx::Size& preferred_size = gfx::Size()); |
| 20 ~StaticSizedView() override; | 20 ~StaticSizedView() override; |
| 21 | 21 |
| 22 void set_minimum_size(const gfx::Size& minimum_size) { | 22 void set_minimum_size(const gfx::Size& minimum_size) { |
| 23 minimum_size_ = minimum_size; | 23 minimum_size_ = minimum_size; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void set_maximum_size(const gfx::Size& maximum_size) { | 26 void set_maximum_size(const gfx::Size& maximum_size) { |
| 27 maximum_size_ = maximum_size; | 27 maximum_size_ = maximum_size; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // View overrides: | 30 // View overrides: |
| 31 gfx::Size GetPreferredSize() const override; | 31 gfx::Size GetPreferredSize() const override; |
| 32 gfx::Size GetMinimumSize() const override; | 32 gfx::Size GetMinimumSize() const override; |
| 33 gfx::Size GetMaximumSize() const override; | 33 gfx::Size GetMaximumSize() const override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 gfx::Size size_; | 36 gfx::Size preferred_size_; |
| 37 gfx::Size minimum_size_; | 37 gfx::Size minimum_size_; |
| 38 gfx::Size maximum_size_; | 38 gfx::Size maximum_size_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(StaticSizedView); | 40 DISALLOW_COPY_AND_ASSIGN(StaticSizedView); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // A view that accomodates testing layouts that use GetHeightForWidth. | 43 // A view that accomodates testing layouts that use GetHeightForWidth. |
| 44 class ProportionallySizedView : public View { | 44 class ProportionallySizedView : public View { |
| 45 public: | 45 public: |
| 46 explicit ProportionallySizedView(int factor); | 46 explicit ProportionallySizedView(int factor); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 std::map<ui::EventType, int> event_count_; | 111 std::map<ui::EventType, int> event_count_; |
| 112 int last_flags_; | 112 int last_flags_; |
| 113 HandleMode handle_mode_; | 113 HandleMode handle_mode_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(EventCountView); | 115 DISALLOW_COPY_AND_ASSIGN(EventCountView); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace views | 118 } // namespace views |
| 119 | 119 |
| 120 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_ | 120 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_ |
| OLD | NEW |