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

Side by Side Diff: ash/wm/root_window_layout_manager_unittest.cc

Issue 1484383003: Use WindowTracker when resizing root window as it may delete other window in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « ash/wm/root_window_layout_manager.cc ('k') | ui/aura/test/test_windows.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ash/wm/root_window_layout_manager.cc ('k') | ui/aura/test/test_windows.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698