chromium/ui/wm/core/transient_window_manager_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/wm/core/transient_window_manager.h"
#include "base/memory/raw_ptr.h"

#include <utility>

#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/aura/window_tracker.h"
#include "ui/wm/core/transient_window_observer.h"
#include "ui/wm/core/window_util.h"

Window;

ChildWindowIDsAsString;
CreateTestWindowWithId;

namespace wm {

class TestTransientWindowObserver : public TransientWindowObserver {};

class WindowVisibilityObserver : public aura::WindowObserver {};

class TransientWindowManagerTest : public aura::test::AuraTestBase {};

// Tests that creating a transient tree with a cycle in it will crash on a
// CHECK. See a crash that can happen if we allow cycles http://b/286947509.
TEST_F(TransientWindowManagerTest, TransientCycle) {}

// Various assertions for transient children.
TEST_F(TransientWindowManagerTest, TransientChildren) {}

// Tests that transient children are stacked as a unit when using stack above.
TEST_F(TransientWindowManagerTest, TransientChildrenGroupAbove) {}

// Tests that transient children are stacked as a unit when using stack below.
TEST_F(TransientWindowManagerTest, TransientChildrenGroupBelow) {}

// Tests that transient windows are stacked properly when created.
TEST_F(TransientWindowManagerTest, StackUponCreation) {}

// Tests for a crash when window destroyed inside
// UpdateTransientChildVisibility loop.
TEST_F(TransientWindowManagerTest, CrashOnVisibilityChange) {}
// Tests that windows are restacked properly after a call to AddTransientChild()
// or RemoveTransientChild().
TEST_F(TransientWindowManagerTest, RestackUponAddOrRemoveTransientChild) {}

namespace {

// Used by NotifyDelegateAfterDeletingTransients. Adds a string to a vector when
// OnWindowDestroyed() is invoked so that destruction order can be verified.
class DestroyedTrackingDelegate : public aura::test::TestWindowDelegate {};

}  // namespace

// Verifies the delegate is notified of destruction after transients are
// destroyed.
TEST_F(TransientWindowManagerTest, NotifyDelegateAfterDeletingTransients) {}

TEST_F(TransientWindowManagerTest,
       StackTransientsLayersRelativeToOtherTransients) {}

// Verifies TransientWindowObserver is notified appropriately.
TEST_F(TransientWindowManagerTest, TransientWindowObserverNotified) {}

TEST_F(TransientWindowManagerTest, ChangeParent) {}

// Tests that the lifetime of the transient window will be determined by its
// transient parent by default. But the transient window is still able to
// outlive the transient parent if we explicitly
// `set_parent_controls_lifetime()` to false through its transient window
// manager.
TEST_F(TransientWindowManagerTest,
       TransientLifeTimeMayBeControlledByTransientParent) {}

}  // namespace wm