OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 scoped_ptr<Window> parent( | 587 scoped_ptr<Window> parent( |
588 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 20, 400, 500), | 588 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 20, 400, 500), |
589 root_window())); | 589 root_window())); |
590 scoped_ptr<Window> child( | 590 scoped_ptr<Window> child( |
591 CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get())); | 591 CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get())); |
592 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); | 592 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); |
593 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); | 593 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); |
594 | 594 |
595 // We can override the hit test bounds of the parent to make the parent grab | 595 // We can override the hit test bounds of the parent to make the parent grab |
596 // events along that edge. | 596 // events along that edge. |
597 parent->set_hit_test_bounds_override_inner(gfx::Insets(1, 1, 1, 1)); | 597 parent->SetHitTestBoundsOverrideInner(gfx::Insets(1, 1, 1, 1), |
| 598 gfx::Insets(1, 1, 1, 1)); |
598 EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); | 599 EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); |
599 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); | 600 EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); |
600 } | 601 } |
601 | 602 |
602 TEST_F(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) { | 603 TEST_F(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) { |
603 scoped_ptr<SelfEventHandlingWindowDelegate> parent_delegate( | 604 scoped_ptr<SelfEventHandlingWindowDelegate> parent_delegate( |
604 new SelfEventHandlingWindowDelegate); | 605 new SelfEventHandlingWindowDelegate); |
605 scoped_ptr<Window> parent(CreateTestWindowWithDelegate( | 606 scoped_ptr<Window> parent(CreateTestWindowWithDelegate( |
606 parent_delegate.get(), 1, gfx::Rect(10, 20, 400, 500), root_window())); | 607 parent_delegate.get(), 1, gfx::Rect(10, 20, 400, 500), root_window())); |
607 scoped_ptr<Window> child( | 608 scoped_ptr<Window> child( |
(...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3230 parent->AddTransientChild(transient); | 3231 parent->AddTransientChild(transient); |
3231 parent.reset(); | 3232 parent.reset(); |
3232 | 3233 |
3233 ASSERT_EQ(2u, destruction_order.size()); | 3234 ASSERT_EQ(2u, destruction_order.size()); |
3234 EXPECT_EQ("transient", destruction_order[0]); | 3235 EXPECT_EQ("transient", destruction_order[0]); |
3235 EXPECT_EQ("parent", destruction_order[1]); | 3236 EXPECT_EQ("parent", destruction_order[1]); |
3236 } | 3237 } |
3237 | 3238 |
3238 } // namespace test | 3239 } // namespace test |
3239 } // namespace aura | 3240 } // namespace aura |
OLD | NEW |