| 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 "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 // A view that requests a set amount of space. | 12 // A view that requests a set amount of space. |
| 13 class StaticSizedView : public View { | 13 class StaticSizedView : public View { |
| 14 public: | 14 public: |
| 15 explicit StaticSizedView(const gfx::Size& size); | 15 explicit StaticSizedView(const gfx::Size& size); |
| 16 virtual ~StaticSizedView(); | 16 virtual ~StaticSizedView(); |
| 17 | 17 |
| 18 virtual gfx::Size GetPreferredSize() OVERRIDE; | 18 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 19 | 19 |
| 20 private: | 20 private: |
| 21 gfx::Size size_; | 21 gfx::Size size_; |
| 22 | 22 |
| 23 DISALLOW_COPY_AND_ASSIGN(StaticSizedView); | 23 DISALLOW_COPY_AND_ASSIGN(StaticSizedView); |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 // A view that accomodates testing layouts that use GetHeightForWidth. | 26 // A view that accomodates testing layouts that use GetHeightForWidth. |
| 27 class ProportionallySizedView : public View { | 27 class ProportionallySizedView : public View { |
| 28 public: | 28 public: |
| 29 explicit ProportionallySizedView(int factor); | 29 explicit ProportionallySizedView(int factor); |
| 30 virtual ~ProportionallySizedView(); | 30 virtual ~ProportionallySizedView(); |
| 31 | 31 |
| 32 virtual int GetHeightForWidth(int w) OVERRIDE; | 32 virtual int GetHeightForWidth(int w) const OVERRIDE; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 // The multiplicative factor between width and height, i.e. | 35 // The multiplicative factor between width and height, i.e. |
| 36 // height = width * factor_. | 36 // height = width * factor_. |
| 37 int factor_; | 37 int factor_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(ProportionallySizedView); | 39 DISALLOW_COPY_AND_ASSIGN(ProportionallySizedView); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 } // namespace views | 42 } // namespace views |
| 43 | 43 |
| 44 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_ | 44 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_ |
| OLD | NEW |