Index: components/exo/sub_surface_unittest.cc |
diff --git a/components/exo/sub_surface_unittest.cc b/components/exo/sub_surface_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..524e3df2fa168f0b6709f83f2d6698c121fa902b |
--- /dev/null |
+++ b/components/exo/sub_surface_unittest.cc |
@@ -0,0 +1,61 @@ |
+// Copyright 2015 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. |
+ |
+#include "components/exo/sub_surface.h" |
+#include "components/exo/surface.h" |
+#include "components/exo/test/exo_test_base.h" |
+#include "components/exo/test/exo_test_helper.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace exo { |
+namespace { |
+ |
+using SubSurfaceTest = test::ExoTestBase; |
+ |
+TEST_F(SubSurfaceTest, SetPosition) { |
+ scoped_ptr<Surface> parent(new Surface); |
+ scoped_ptr<Surface> surface(new Surface); |
+ scoped_ptr<SubSurface> sub_surface( |
+ new SubSurface(surface.get(), parent.get())); |
+ |
+ sub_surface->SetPosition(gfx::Point(10, 10)); |
+ parent->Commit(); |
+} |
+ |
+TEST_F(SubSurfaceTest, PlaceAbove) { |
+ scoped_ptr<Surface> parent(new Surface); |
+ scoped_ptr<Surface> surface1(new Surface); |
+ scoped_ptr<Surface> surface2(new Surface); |
+ scoped_ptr<Surface> non_sibling_surface(new Surface); |
+ scoped_ptr<SubSurface> sub_surface1( |
+ new SubSurface(surface1.get(), parent.get())); |
+ scoped_ptr<SubSurface> sub_surface2( |
+ new SubSurface(surface2.get(), parent.get())); |
+ |
+ sub_surface2->PlaceAbove(parent.get()); |
+ sub_surface1->PlaceAbove(non_sibling_surface.get()); // Invalid |
+ sub_surface1->PlaceAbove(surface1.get()); // Invalid |
+ sub_surface1->PlaceAbove(surface2.get()); |
+ parent->Commit(); |
+} |
+ |
+TEST_F(SubSurfaceTest, PlaceBelow) { |
+ scoped_ptr<Surface> parent(new Surface); |
+ scoped_ptr<Surface> surface1(new Surface); |
+ scoped_ptr<Surface> surface2(new Surface); |
+ scoped_ptr<Surface> non_sibling_surface(new Surface); |
+ scoped_ptr<SubSurface> sub_surface1( |
+ new SubSurface(surface1.get(), parent.get())); |
+ scoped_ptr<SubSurface> sub_surface2( |
+ new SubSurface(surface2.get(), parent.get())); |
+ |
+ sub_surface2->PlaceBelow(parent.get()); // Invalid |
+ sub_surface2->PlaceBelow(non_sibling_surface.get()); // Invalid |
+ sub_surface2->PlaceBelow(surface1.get()); |
+ sub_surface1->PlaceBelow(surface2.get()); |
+ parent->Commit(); |
+} |
+ |
+} // namespace |
+} // namespace exo |