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