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

Side by Side Diff: ui/views/widget/native_widget_aura_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: Use ShouldDescendIntoChildForEventHandling 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL); 328 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL);
329 child_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 329 child_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
330 child_params.parent = parent->GetNativeWindow(); 330 child_params.parent = parent->GetNativeWindow();
331 child->Init(child_params); 331 child->Init(child_params);
332 child->SetBounds(gfx::Rect(0, 0, 200, 200)); 332 child->SetBounds(gfx::Rect(0, 0, 200, 200));
333 child->Show(); 333 child->Show();
334 334
335 // Point is over |child|. 335 // Point is over |child|.
336 EXPECT_EQ(child->GetNativeWindow(), 336 EXPECT_EQ(child->GetNativeWindow(),
337 parent->GetNativeWindow()->GetEventHandlerForPoint( 337 parent->GetNativeWindow()->GetEventHandlerForPoint(
338 gfx::Point(50, 50))); 338 gfx::Point(50, 50), ui::ET_MOUSE_ENTERED));
339 339
340 // Create a view with a layer and stack it at the top (above |child|). 340 // Create a view with a layer and stack it at the top (above |child|).
341 views::View* view_with_layer = new views::View; 341 views::View* view_with_layer = new views::View;
342 parent_root->AddChildView(view_with_layer); 342 parent_root->AddChildView(view_with_layer);
343 view_with_layer->SetBounds(0, 0, 50, 50); 343 view_with_layer->SetBounds(0, 0, 50, 50);
344 view_with_layer->SetPaintToLayer(true); 344 view_with_layer->SetPaintToLayer(true);
345 345
346 // Point is over |view_with_layer|, it should get the event. 346 // Point is over |view_with_layer|, it should get the event.
347 EXPECT_EQ(parent->GetNativeWindow(), 347 EXPECT_EQ(parent->GetNativeWindow(),
348 parent->GetNativeWindow()->GetEventHandlerForPoint( 348 parent->GetNativeWindow()->GetEventHandlerForPoint(
349 gfx::Point(20, 20))); 349 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
350 350
351 // Point is over |child|, it should get the event. 351 // Point is over |child|, it should get the event.
352 EXPECT_EQ(child->GetNativeWindow(), 352 EXPECT_EQ(child->GetNativeWindow(),
353 parent->GetNativeWindow()->GetEventHandlerForPoint( 353 parent->GetNativeWindow()->GetEventHandlerForPoint(
354 gfx::Point(70, 70))); 354 gfx::Point(70, 70), ui::ET_MOUSE_ENTERED));
355 355
356 // Move |child| to the top and make sure it gets the event. 356 // Move |child| to the top and make sure it gets the event.
357 child->GetNativeWindow()->layer()->parent()->StackAtTop( 357 child->GetNativeWindow()->layer()->parent()->StackAtTop(
358 child->GetNativeWindow()->layer()); 358 child->GetNativeWindow()->layer());
359 EXPECT_EQ(child->GetNativeWindow(), 359 EXPECT_EQ(child->GetNativeWindow(),
360 parent->GetNativeWindow()->GetEventHandlerForPoint( 360 parent->GetNativeWindow()->GetEventHandlerForPoint(
361 gfx::Point(20, 20))); 361 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
362 362
363 delete view_with_layer; 363 delete view_with_layer;
364 view_with_layer = NULL; 364 view_with_layer = NULL;
365 365
366 EXPECT_EQ(child->GetNativeWindow(), 366 EXPECT_EQ(child->GetNativeWindow(),
367 parent->GetNativeWindow()->GetEventHandlerForPoint( 367 parent->GetNativeWindow()->GetEventHandlerForPoint(
368 gfx::Point(20, 20))); 368 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
369 369
370 // Work around for bug in NativeWidgetAura. 370 // Work around for bug in NativeWidgetAura.
371 // TODO: fix bug and remove this. 371 // TODO: fix bug and remove this.
372 parent->Close(); 372 parent->Close();
373 } 373 }
374 374
375 } // namespace 375 } // namespace
376 } // namespace views 376 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698