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

Unified Diff: ui/aura/window_unittest.cc

Issue 10831361: Draggable region support for frameless app window on CrOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove event type filtering Created 8 years, 4 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 | « chrome/browser/ui/views/extensions/shell_window_views.cc ('k') | ui/views/widget/native_widget_aura.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 cb7ad0ec7e7458e3d53053a91fefb2af2dd9201c..09be9ea088a82ffb9b7a97ca33f35f7940866f0c 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -236,6 +236,20 @@ base::TimeDelta getTime() {
return base::Time::NowFromSystemTime() - base::Time();
}
+class SelfEventHandlingWindowDelegate : public TestWindowDelegate {
+ public:
+ SelfEventHandlingWindowDelegate() {}
+
+ virtual bool ShouldDescendIntoChildForEventHandling(
+ Window* child,
+ const gfx::Point& location) OVERRIDE {
+ return false;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SelfEventHandlingWindowDelegate);
+};
+
} // namespace
TEST_F(WindowTest, GetChildById) {
@@ -514,6 +528,21 @@ TEST_F(WindowTest, GetEventHandlerForPointWithOverride) {
EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
}
+TEST_F(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) {
+ scoped_ptr<SelfEventHandlingWindowDelegate> parent_delegate(
+ new SelfEventHandlingWindowDelegate);
+ scoped_ptr<Window> parent(CreateTestWindowWithDelegate(
+ parent_delegate.get(), 1, gfx::Rect(10, 20, 400, 500), NULL));
+ scoped_ptr<Window> child(
+ CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 390, 480),
+ parent.get()));
+
+ // We can override ShouldDescendIntoChildForEventHandling to make the parent
+ // grab all events.
+ EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
+ EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(50, 50)));
+}
+
TEST_F(WindowTest, GetTopWindowContainingPoint) {
Window* root = root_window();
root->SetBounds(gfx::Rect(0, 0, 300, 300));
« no previous file with comments | « chrome/browser/ui/views/extensions/shell_window_views.cc ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698