Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ | |
| 6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | |
| 11 #include "mojo/services/public/cpp/view_manager/view.h" | |
| 12 #include "mojo/services/window_manager/view_target.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 class Rect; | |
| 16 } | |
| 17 | |
| 18 namespace mojo { | |
| 19 | |
| 20 class ViewCollector; | |
| 21 | |
| 22 // A wrapper around View so we can instantiate these directly without a | |
| 23 // ViewManager. | |
| 24 class TestView : public View { | |
| 25 public: | |
| 26 TestView(int id, | |
| 27 const gfx::Rect& rect, | |
| 28 ViewCollector* collector); | |
| 29 ~TestView(); | |
| 30 | |
| 31 private: | |
| 32 DISALLOW_COPY_AND_ASSIGN(TestView); | |
| 33 }; | |
| 34 | |
| 35 // A wrapper around ViewTarget which builds the wrapped TestView for us. | |
| 36 class TestViewTarget : public ViewTarget { | |
| 37 public: | |
| 38 TestViewTarget(int id, | |
| 39 const gfx::Rect& rect, | |
| 40 ViewCollector* collector); | |
| 41 ~TestViewTarget(); | |
| 42 | |
| 43 // Add's |child|'s View to our wrapped View's children. | |
| 44 void AddChild(TestViewTarget* child); | |
| 45 | |
| 46 private: | |
| 47 DISALLOW_COPY_AND_ASSIGN(TestViewTarget); | |
| 48 }; | |
| 49 | |
| 50 // A helper class which owns all the mojo::Views. We need this in tests because | |
| 51 // we don't have the WindowManagerApp around to build this for us. | |
| 52 class ViewCollector { | |
|
sky
2014/11/14 01:43:57
It's not clear to me why TestView and TestViewTarg
Elliot Glaysher
2014/11/14 21:04:29
This class is gone due to the rejiggering of the o
| |
| 53 public: | |
| 54 ViewCollector(); | |
| 55 ~ViewCollector(); | |
| 56 | |
| 57 void AddView(TestView* view); | |
| 58 void Destroy(); | |
| 59 | |
| 60 private: | |
| 61 std::set<TestView*> views_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(ViewCollector); | |
| 64 }; | |
| 65 | |
| 66 } // namespace mojo | |
| 67 | |
| 68 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ | |
| OLD | NEW |