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

Unified Diff: ui/views/widget/native_widget_aura_unittest.cc

Issue 15114002: Reorder the NativeViews attached to a view via kViewHostKey according to the position of the view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/views/widget/native_widget_aura.cc ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura_unittest.cc
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index 13e7de542ef160994b9f2b19008ccf7aa1eb7de4..ae8b22352b0127d9c9d4a93ea3c0eedf80ef015e 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -315,8 +315,7 @@ TEST_F(NativeWidgetAuraTest, ReleaseCaptureOnTouchRelease) {
// Verifies views with layers are targeted for events properly.
TEST_F(NativeWidgetAuraTest, PreferViewLayersToChildWindows) {
- // Create two widget, |parent_root| and |child|. |child| is a child of
- // |parent_root|.
+ // Create two widgets: |parent| and |child|. |child| is a child of |parent|.
views::View* parent_root = new views::View;
scoped_ptr<Widget> parent(new Widget());
Widget::InitParams parent_params(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
@@ -341,13 +340,21 @@ TEST_F(NativeWidgetAuraTest, PreferViewLayersToChildWindows) {
parent->GetNativeWindow()->GetEventHandlerForPoint(
gfx::Point(50, 50)));
- // Create a view with a layer and stack it at the top (above |child|).
+ // Create a view with a layer and stack it at the bottom (below |child|).
views::View* view_with_layer = new views::View;
parent_root->AddChildView(view_with_layer);
view_with_layer->SetBounds(0, 0, 50, 50);
view_with_layer->SetPaintToLayer(true);
- // Point is over |view_with_layer|, it should get the event.
+ // Make sure that |child| still gets the event.
+ EXPECT_EQ(child->GetNativeWindow(),
+ parent->GetNativeWindow()->GetEventHandlerForPoint(
+ gfx::Point(20, 20)));
+
+ // Move |view_with_layer| to the top and make sure it gets the
+ // event when the point is within |view_with_layer|'s bounds.
+ view_with_layer->layer()->parent()->StackAtTop(
+ view_with_layer->layer());
EXPECT_EQ(parent->GetNativeWindow(),
parent->GetNativeWindow()->GetEventHandlerForPoint(
gfx::Point(20, 20)));
@@ -357,13 +364,6 @@ TEST_F(NativeWidgetAuraTest, PreferViewLayersToChildWindows) {
parent->GetNativeWindow()->GetEventHandlerForPoint(
gfx::Point(70, 70)));
- // Move |child| to the top and make sure it gets the event.
- child->GetNativeWindow()->layer()->parent()->StackAtTop(
- child->GetNativeWindow()->layer());
- EXPECT_EQ(child->GetNativeWindow(),
- parent->GetNativeWindow()->GetEventHandlerForPoint(
- gfx::Point(20, 20)));
-
delete view_with_layer;
view_with_layer = NULL;
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698