OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/shell.h" |
| 6 #include "ash/shell_window_ids.h" |
| 7 #include "ash/test/ash_test_base.h" |
| 8 #include "ui/aura/test/test_windows.h" |
| 9 #include "ui/aura/window_observer.h" |
| 10 |
| 11 namespace ash { |
| 12 namespace { |
| 13 |
| 14 class WindowDeleter : public aura::WindowObserver { |
| 15 public: |
| 16 explicit WindowDeleter(aura::Window* window) : target_(window) {} |
| 17 |
| 18 // aura::WindowObserver:: |
| 19 void OnWindowBoundsChanged(aura::Window* window, |
| 20 const gfx::Rect& old_bounds, |
| 21 const gfx::Rect& new_bounds) override { |
| 22 delete target_; |
| 23 } |
| 24 |
| 25 private: |
| 26 aura::Window* target_; |
| 27 |
| 28 DISALLOW_COPY_AND_ASSIGN(WindowDeleter); |
| 29 }; |
| 30 |
| 31 } // namespace |
| 32 |
| 33 using RootWindowLayoutManagerTest = test::AshTestBase; |
| 34 |
| 35 TEST_F(RootWindowLayoutManagerTest, DeleteChildDuringResize) { |
| 36 aura::Window* parent = Shell::GetPrimaryRootWindow()->GetChildById( |
| 37 kShellWindowId_DesktopBackgroundContainer); |
| 38 aura::Window* w1 = aura::test::CreateTestWindowWithId(1, parent); |
| 39 aura::Window* w2 = aura::test::CreateTestWindowWithId(2, parent); |
| 40 WindowDeleter deleter(w1); |
| 41 w2->AddObserver(&deleter); |
| 42 UpdateDisplay("600x500"); |
| 43 w2->RemoveObserver(&deleter); |
| 44 } |
| 45 |
| 46 } // namespace ash |
OLD | NEW |