Index: mojo/services/window_manager/window_manager_test_util.h |
diff --git a/mojo/services/window_manager/window_manager_test_util.h b/mojo/services/window_manager/window_manager_test_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1fb3943359307d1b18b22b2ef8c0a67463483e77 |
--- /dev/null |
+++ b/mojo/services/window_manager/window_manager_test_util.h |
@@ -0,0 +1,68 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ |
+#define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ |
+ |
+#include <set> |
+ |
+#include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
+#include "mojo/services/public/cpp/view_manager/view.h" |
+#include "mojo/services/window_manager/view_target.h" |
+ |
+namespace gfx { |
+class Rect; |
+} |
+ |
+namespace mojo { |
+ |
+class ViewCollector; |
+ |
+// A wrapper around View so we can instantiate these directly without a |
+// ViewManager. |
+class TestView : public View { |
+ public: |
+ TestView(int id, |
+ const gfx::Rect& rect, |
+ ViewCollector* collector); |
+ ~TestView(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TestView); |
+}; |
+ |
+// A wrapper around ViewTarget which builds the wrapped TestView for us. |
+class TestViewTarget : public ViewTarget { |
+ public: |
+ TestViewTarget(int id, |
+ const gfx::Rect& rect, |
+ ViewCollector* collector); |
+ ~TestViewTarget(); |
+ |
+ // Add's |child|'s View to our wrapped View's children. |
+ void AddChild(TestViewTarget* child); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TestViewTarget); |
+}; |
+ |
+// A helper class which owns all the mojo::Views. We need this in tests because |
+// we don't have the WindowManagerApp around to build this for us. |
+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
|
+ public: |
+ ViewCollector(); |
+ ~ViewCollector(); |
+ |
+ void AddView(TestView* view); |
+ void Destroy(); |
+ |
+ private: |
+ std::set<TestView*> views_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ViewCollector); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_TEST_UTIL_H_ |