OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_LAYOUT_MANAGER_H_ | |
6 #define UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_ | |
7 | |
8 #include "ui/gfx/geometry/size.h" | |
9 #include "ui/views/layout/layout_manager.h" | |
10 | |
11 namespace views { | |
12 namespace test { | |
13 | |
14 // A stub layout manager that returns a specific preferred size and height for | |
15 // width. | |
16 class TestLayoutManager : public LayoutManager { | |
17 public: | |
18 TestLayoutManager(); | |
19 ~TestLayoutManager() override; | |
20 | |
21 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; } | |
22 | |
23 void set_preferred_height_for_width(int height) { | |
24 preferred_height_for_width_ = height; | |
25 } | |
26 | |
27 // LayoutManager: | |
28 void Layout(View* host) override; | |
29 gfx::Size GetPreferredSize(const View* host) const override; | |
30 int GetPreferredHeightForWidth(const View* host, int width) const override; | |
31 | |
32 private: | |
33 // The return value of GetPreferredSize(); | |
34 gfx::Size preferred_size_; | |
35 | |
36 // The return value for GetPreferredHeightForWidth(). | |
37 int preferred_height_for_width_ = 0; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(TestLayoutManager); | |
40 }; | |
41 | |
42 } // namespace test | |
43 } // namespace views | |
44 | |
45 #endif // UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_ | |
OLD | NEW |