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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/root_window_layout_manager_unittest.cc
diff --git a/ash/wm/root_window_layout_manager_unittest.cc b/ash/wm/root_window_layout_manager_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..57693016801cfe9846739accad0caee880aa27b6
--- /dev/null
+++ b/ash/wm/root_window_layout_manager_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ash/test/ash_test_base.h"
+#include "ui/aura/test/test_windows.h"
+#include "ui/aura/window_observer.h"
+
+namespace ash {
+namespace {
+
+class WindowDeleter : public aura::WindowObserver {
+ public:
+ explicit WindowDeleter(aura::Window* window) : target_(window) {}
+
+ // aura::WindowObserver::
+ void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override {
+ delete target_;
+ }
+
+ private:
+ aura::Window* target_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowDeleter);
+};
+
+} // namespace
+
+using RootWindowLayoutManagerTest = test::AshTestBase;
+
+TEST_F(RootWindowLayoutManagerTest, DeleteChildDuringResize) {
+ aura::Window* parent = Shell::GetPrimaryRootWindow()->GetChildById(
+ kShellWindowId_DesktopBackgroundContainer);
+ aura::Window* w1 = aura::test::CreateTestWindowWithId(1, parent);
+ aura::Window* w2 = aura::test::CreateTestWindowWithId(2, parent);
+ WindowDeleter deleter(w1);
+ w2->AddObserver(&deleter);
+ UpdateDisplay("600x500");
+ w2->RemoveObserver(&deleter);
+}
+
+} // namespace ash
« 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