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

Unified Diff: ui/aura/window_unittest.cc

Issue 8120014: Add a lock screen example. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/aura_shell.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
===================================================================
--- ui/aura/window_unittest.cc (revision 103882)
+++ ui/aura/window_unittest.cc (working copy)
@@ -585,7 +585,7 @@
gfx::Rect(0, 0, 500, 500), NULL));
scoped_ptr<Window> w11(CreateTestWindowWithDelegate(NULL, 11,
gfx::Rect(0, 0, 500, 500), w1.get()));
- scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 1,
+ scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 111,
gfx::Rect(50, 50, 450, 450), w11.get()));
scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12,
gfx::Rect(0, 0, 500, 500), w1.get()));
@@ -594,5 +594,31 @@
EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(target_point));
}
+// When set_consume_events() is called with |true| for a Window, that Window
+// should make sure that none behind it in the z-order see events if it has
+// children. If it does not have children, event targeting works as usual.
+TEST_F(WindowTest, ConsumesEvents) {
+ WindowDelegateImpl d11;
+ WindowDelegateImpl d121;
+ scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1,
+ gfx::Rect(0, 0, 500, 500), NULL));
+ scoped_ptr<Window> w11(CreateTestWindowWithDelegate(&d11, 11,
+ gfx::Rect(0, 0, 500, 500), w1.get()));
+ scoped_ptr<Window> w111(CreateTestWindowWithDelegate(NULL, 111,
+ gfx::Rect(50, 50, 450, 450), w11.get()));
+ scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12,
+ gfx::Rect(0, 0, 500, 500), w1.get()));
+ scoped_ptr<Window> w121(CreateTestWindowWithDelegate(&d121, 121,
+ gfx::Rect(150, 150, 50, 50), NULL));
+
+ w12->set_consumes_events(true);
+ EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(10, 10)));
+
+ w12->AddChild(w121.get());
+
+ EXPECT_EQ(NULL, w1->GetEventHandlerForPoint(gfx::Point(10, 10)));
+ EXPECT_EQ(w121.get(), w1->GetEventHandlerForPoint(gfx::Point(175, 175)));
+}
+
} // namespace internal
} // namespace aura
« no previous file with comments | « ui/aura/window.cc ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698