Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: ui/aura/window_unittest.cc

Issue 7980023: Fixes aura unit tests. There were a couple of problems: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura_shell/desktop_layout_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 1025d4477c82d357825cbe233de12c824a95a695..2c8918f2ce5e9fde1fbfe2ec0505068c8470fe11 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -12,6 +12,7 @@
#include "ui/aura/root_window.h"
#include "ui/aura/window_delegate.h"
#include "ui/gfx/canvas_skia.h"
+#include "ui/gfx/compositor/layer.h"
#include "ui/base/keycodes/keyboard_codes.h"
#if !defined(OS_WIN)
@@ -218,7 +219,7 @@ TEST_F(WindowTest, GetEventHandlerForPoint) {
CreateTestWindow(SK_ColorGRAY, 13, gfx::Rect(5, 470, 50, 50), w1.get()));
Window* desktop = Desktop::GetInstance()->window();
- EXPECT_EQ(desktop, desktop->GetEventHandlerForPoint(gfx::Point(5, 5)));
+ EXPECT_EQ(NULL, desktop->GetEventHandlerForPoint(gfx::Point(5, 5)));
EXPECT_EQ(w1.get(), desktop->GetEventHandlerForPoint(gfx::Point(11, 11)));
EXPECT_EQ(w11.get(), desktop->GetEventHandlerForPoint(gfx::Point(16, 16)));
EXPECT_EQ(w111.get(), desktop->GetEventHandlerForPoint(gfx::Point(21, 21)));
@@ -277,6 +278,33 @@ TEST_F(WindowTest, DestroyTest) {
EXPECT_EQ(1, child_delegate.destroyed_count());
}
+// Make sure MoveChildToFront moves both the window and layer to the front.
+TEST_F(WindowTest, MoveChildToFront) {
+ Window parent(NULL);
+ parent.Init();
+ Window child1(NULL);
+ child1.Init();
+ Window child2(NULL);
+ child2.Init();
+
+ child1.SetParent(&parent);
+ child2.SetParent(&parent);
+ ASSERT_EQ(2u, parent.children().size());
+ EXPECT_EQ(&child1, parent.children()[0]);
+ EXPECT_EQ(&child2, parent.children()[1]);
+ ASSERT_EQ(2u, parent.layer()->children().size());
+ EXPECT_EQ(child1.layer(), parent.layer()->children()[0]);
+ EXPECT_EQ(child2.layer(), parent.layer()->children()[1]);
+
+ parent.MoveChildToFront(&child1);
+ ASSERT_EQ(2u, parent.children().size());
+ EXPECT_EQ(&child1, parent.children()[1]);
+ EXPECT_EQ(&child2, parent.children()[0]);
+ ASSERT_EQ(2u, parent.layer()->children().size());
+ EXPECT_EQ(child1.layer(), parent.layer()->children()[1]);
+ EXPECT_EQ(child2.layer(), parent.layer()->children()[0]);
+}
+
} // namespace internal
} // namespace aura
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura_shell/desktop_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698