// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <memory> #include "base/memory/raw_ptr.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/compositor/layer.h" #include "ui/compositor/test/test_layers.h" #include "ui/views/test/views_test_base.h" #include "ui/views/view.h" #include "ui/views/view_constants_aura.h" #include "ui/views/widget/widget.h" namespace views { namespace { // Sets the name of |window| and |window|'s layer to |name|. void SetWindowAndLayerName(aura::Window* window, const std::string& name) { … } // Returns a string containing the name of each of the child windows (bottommost // first) of |parent|. The format of the string is "name1 name2 name3 ...". std::string ChildWindowNamesAsString(const aura::Window& parent) { … } class WindowReordererTest : public ViewsTestBase { … }; // Test that views with layers and views with associated windows are reordered // according to the view hierarchy. TEST_F(WindowReordererTest, Basic) { … } // Test that different orderings of: // - adding a window to a parent widget // - adding a "host" view to a parent widget // - associating the "host" view and window // all correctly reorder the child windows and layers. TEST_F(WindowReordererTest, Association) { … } // It is possible to associate a window to a view which has a parent layer // (other than the widget layer). In this case, the parent layer of the host // view and the parent layer of the associated window are different. Test that // the layers and windows are properly reordered in this case. TEST_F(WindowReordererTest, HostViewParentHasLayer) { … } // Test that a layer added beneath a view is restacked correctly. TEST_F(WindowReordererTest, ViewWithLayerBeneath) { … } } // namespace } // namespace views