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

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: Fix build 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
« ui/aura/window.h ('K') | « ui/aura/window_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL); 327 Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL);
328 child_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 328 child_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
329 child_params.parent = parent->GetNativeWindow(); 329 child_params.parent = parent->GetNativeWindow();
330 child->Init(child_params); 330 child->Init(child_params);
331 child->SetBounds(gfx::Rect(0, 0, 200, 200)); 331 child->SetBounds(gfx::Rect(0, 0, 200, 200));
332 child->Show(); 332 child->Show();
333 333
334 // Point is over |child|. 334 // Point is over |child|.
335 EXPECT_EQ(child->GetNativeWindow(), 335 EXPECT_EQ(child->GetNativeWindow(),
336 parent->GetNativeWindow()->GetEventHandlerForPoint( 336 parent->GetNativeWindow()->GetEventHandlerForPoint(
337 gfx::Point(50, 50))); 337 gfx::Point(50, 50), ui::ET_MOUSE_ENTERED));
338 338
339 // Create a view with a layer and stack it at the top (above |child|). 339 // Create a view with a layer and stack it at the top (above |child|).
340 views::View* view_with_layer = new views::View; 340 views::View* view_with_layer = new views::View;
341 parent_root->AddChildView(view_with_layer); 341 parent_root->AddChildView(view_with_layer);
342 view_with_layer->SetBounds(0, 0, 50, 50); 342 view_with_layer->SetBounds(0, 0, 50, 50);
343 view_with_layer->SetPaintToLayer(true); 343 view_with_layer->SetPaintToLayer(true);
344 344
345 // Point is over |view_with_layer|, it should get the event. 345 // Point is over |view_with_layer|, it should get the event.
346 EXPECT_EQ(parent->GetNativeWindow(), 346 EXPECT_EQ(parent->GetNativeWindow(),
347 parent->GetNativeWindow()->GetEventHandlerForPoint( 347 parent->GetNativeWindow()->GetEventHandlerForPoint(
348 gfx::Point(20, 20))); 348 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
349 349
350 // Point is over |child|, it should get the event. 350 // Point is over |child|, it should get the event.
351 EXPECT_EQ(child->GetNativeWindow(), 351 EXPECT_EQ(child->GetNativeWindow(),
352 parent->GetNativeWindow()->GetEventHandlerForPoint( 352 parent->GetNativeWindow()->GetEventHandlerForPoint(
353 gfx::Point(70, 70))); 353 gfx::Point(70, 70), ui::ET_MOUSE_ENTERED));
354 354
355 // Move |child| to the top and make sure it gets the event. 355 // Move |child| to the top and make sure it gets the event.
356 child->GetNativeWindow()->layer()->parent()->StackAtTop( 356 child->GetNativeWindow()->layer()->parent()->StackAtTop(
357 child->GetNativeWindow()->layer()); 357 child->GetNativeWindow()->layer());
358 EXPECT_EQ(child->GetNativeWindow(), 358 EXPECT_EQ(child->GetNativeWindow(),
359 parent->GetNativeWindow()->GetEventHandlerForPoint( 359 parent->GetNativeWindow()->GetEventHandlerForPoint(
360 gfx::Point(20, 20))); 360 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
361 361
362 delete view_with_layer; 362 delete view_with_layer;
363 view_with_layer = NULL; 363 view_with_layer = NULL;
364 364
365 EXPECT_EQ(child->GetNativeWindow(), 365 EXPECT_EQ(child->GetNativeWindow(),
366 parent->GetNativeWindow()->GetEventHandlerForPoint( 366 parent->GetNativeWindow()->GetEventHandlerForPoint(
367 gfx::Point(20, 20))); 367 gfx::Point(20, 20), ui::ET_MOUSE_ENTERED));
368 368
369 // Work around for bug in NativeWidgetAura. 369 // Work around for bug in NativeWidgetAura.
370 // TODO: fix bug and remove this. 370 // TODO: fix bug and remove this.
371 parent->Close(); 371 parent->Close();
372 } 372 }
373 373
374 } // namespace 374 } // namespace
375 } // namespace views 375 } // namespace views
OLDNEW
« ui/aura/window.h ('K') | « ui/aura/window_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698