diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 21:00:03 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 21:00:03 +0000 |
commit | 5ebe610732ff3d41b2c288e332767ef56d67fcd3 (patch) | |
tree | ad306d1d45b9dee174640ecbecb9e305220a42e0 /ash/drag_drop/drag_drop_tracker_unittest.cc | |
parent | 3e3f945d8a7b0305b5aaf7a31edb6bb23176229c (diff) | |
download | chromium_src-5ebe610732ff3d41b2c288e332767ef56d67fcd3.zip chromium_src-5ebe610732ff3d41b2c288e332767ef56d67fcd3.tar.gz chromium_src-5ebe610732ff3d41b2c288e332767ef56d67fcd3.tar.bz2 |
Desktop aura: Break aura::Window::SetParent in two.
Previously, SetParent will query a global StackingClient object if NULL is
passed to it. Since we want different behavior on the desktop and on ash, we
need to break that. It has been replaced with two methods:
- SetParentTo(), which takes an aura window and does the parenting.
- SetDefaultParentByTargetRoot(), which takes a RootWindow as context and
asks the StackingClient on said RootWindow where it should parent the
window.
The problem is that people have relied for a long time on what amounts to a
global variable. This is the first of several patches that pass around a
context RootWindow. This patch focuses on ash/ unittests mostly. Later patches
will focus on threading context through Widget creation. The last patch in this
series will pull out the global stacking client interface and add DCHECKs so
NULL can't be passed to either of these methods on Window.
BUG=161882
Review URL: https://chromiumcodereview.appspot.com/11421006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop/drag_drop_tracker_unittest.cc')
-rw-r--r-- | ash/drag_drop/drag_drop_tracker_unittest.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ash/drag_drop/drag_drop_tracker_unittest.cc b/ash/drag_drop/drag_drop_tracker_unittest.cc index 279e17e..d8a1f10 100644 --- a/ash/drag_drop/drag_drop_tracker_unittest.cc +++ b/ash/drag_drop/drag_drop_tracker_unittest.cc @@ -22,19 +22,17 @@ class DragDropTrackerTest : public test::AshTestBase { UpdateDisplay("200x200,200x200"); } - static aura::Window* CreateTestWindow(const gfx::Rect& bounds, - aura::Window* parent) { + aura::Window* CreateTestWindow(const gfx::Rect& bounds) { static int window_id = 0; - return aura::test::CreateTestWindowWithDelegate( + return CreateTestWindowInShellWithDelegate( aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), window_id++, - bounds, - parent); + bounds); } static aura::Window* GetTarget(const gfx::Point& location) { scoped_ptr<internal::DragDropTracker> tracker( - new internal::DragDropTracker); + new internal::DragDropTracker(Shell::GetPrimaryRootWindow())); ui::MouseEvent e(ui::ET_MOUSE_DRAGGED, location, location, @@ -46,7 +44,7 @@ class DragDropTrackerTest : public test::AshTestBase { static ui::LocatedEvent* ConvertEvent(aura::Window* target, const ui::MouseEvent& event) { scoped_ptr<internal::DragDropTracker> tracker( - new internal::DragDropTracker); + new internal::DragDropTracker(Shell::GetPrimaryRootWindow())); ui::LocatedEvent* converted = tracker->ConvertEvent(target, event); return converted; } @@ -67,13 +65,13 @@ TEST_F(DragDropTrackerTest, MAYBE_GetTarget) { Shell::GetInstance()->set_active_root_window(root_windows[0]); scoped_ptr<aura::Window> window0( - CreateTestWindow(gfx::Rect(0, 0, 100, 100), NULL)); + CreateTestWindow(gfx::Rect(0, 0, 100, 100))); window0->Show(); Shell::GetInstance()->set_active_root_window(root_windows[1]); scoped_ptr<aura::Window> window1( - CreateTestWindow(gfx::Rect(100, 100, 100, 100), NULL)); + CreateTestWindow(gfx::Rect(100, 100, 100, 100))); window1->Show(); // Make RootWindow0 active so that capture window is parented to it. @@ -133,12 +131,12 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) { Shell::GetInstance()->set_active_root_window(root_windows[0]); scoped_ptr<aura::Window> window0( - CreateTestWindow(gfx::Rect(0, 0, 100, 100), NULL)); + CreateTestWindow(gfx::Rect(0, 0, 100, 100))); window0->Show(); Shell::GetInstance()->set_active_root_window(root_windows[1]); scoped_ptr<aura::Window> window1( - CreateTestWindow(gfx::Rect(100, 100, 100, 100), NULL)); + CreateTestWindow(gfx::Rect(100, 100, 100, 100))); window1->Show(); // Make RootWindow0 active so that capture window is parented to it. |