Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / ui / views / test / test_views.h
blob8c490dc98381d4457d44ceed851c7f235f8a0848
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/events/event_constants.h"
10 #include "ui/views/view.h"
12 namespace views {
14 // A view that requests a set amount of space.
15 class StaticSizedView : public View {
16 public:
17 explicit StaticSizedView(const gfx::Size& size);
18 ~StaticSizedView() override;
20 void set_minimum_size(const gfx::Size& minimum_size) {
21 minimum_size_ = minimum_size;
24 void set_maximum_size(const gfx::Size& maximum_size) {
25 maximum_size_ = maximum_size;
28 // View overrides:
29 gfx::Size GetPreferredSize() const override;
30 gfx::Size GetMinimumSize() const override;
31 gfx::Size GetMaximumSize() const override;
33 private:
34 gfx::Size size_;
35 gfx::Size minimum_size_;
36 gfx::Size maximum_size_;
38 DISALLOW_COPY_AND_ASSIGN(StaticSizedView);
41 // A view that accomodates testing layouts that use GetHeightForWidth.
42 class ProportionallySizedView : public View {
43 public:
44 explicit ProportionallySizedView(int factor);
45 ~ProportionallySizedView() override;
47 void set_preferred_width(int width) { preferred_width_ = width; }
49 int GetHeightForWidth(int w) const override;
50 gfx::Size GetPreferredSize() const override;
52 private:
53 // The multiplicative factor between width and height, i.e.
54 // height = width * factor_.
55 int factor_;
57 // The width used as the preferred size. -1 if not used.
58 int preferred_width_;
60 DISALLOW_COPY_AND_ASSIGN(ProportionallySizedView);
63 // Class that closes the widget (which ends up deleting it immediately) when the
64 // appropriate event is received.
65 class CloseWidgetView : public View {
66 public:
67 explicit CloseWidgetView(ui::EventType event_type);
69 // ui::EventHandler override:
70 void OnEvent(ui::Event* event) override;
72 private:
73 const ui::EventType event_type_;
75 DISALLOW_COPY_AND_ASSIGN(CloseWidgetView);
78 } // namespace views
80 #endif // UI_VIEWS_TEST_TEST_VIEWS_H_