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.
5 #ifndef UI_VIEWS_TEST_TEST_VIEWS_H_
6 #define UI_VIEWS_TEST_TEST_VIEWS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/views/view.h"
13 // A view that requests a set amount of space.
14 class StaticSizedView
: public View
{
16 explicit StaticSizedView(const gfx::Size
& size
);
17 ~StaticSizedView() override
;
19 gfx::Size
GetPreferredSize() const override
;
24 DISALLOW_COPY_AND_ASSIGN(StaticSizedView
);
27 // A view that accomodates testing layouts that use GetHeightForWidth.
28 class ProportionallySizedView
: public View
{
30 explicit ProportionallySizedView(int factor
);
31 ~ProportionallySizedView() override
;
33 void set_preferred_width(int width
) { preferred_width_
= width
; }
35 int GetHeightForWidth(int w
) const override
;
36 gfx::Size
GetPreferredSize() const override
;
39 // The multiplicative factor between width and height, i.e.
40 // height = width * factor_.
43 // The width used as the preferred size. -1 if not used.
46 DISALLOW_COPY_AND_ASSIGN(ProportionallySizedView
);
51 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_