chromium/ui/views/widget/unique_widget_ptr_unittest.cc

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

#include "ui/views/widget/unique_widget_ptr.h"

#include <memory>
#include <utility>

#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
#include "ui/views/view_observer.h"
#include "ui/views/widget/widget.h"

namespace views {

class UniqueWidgetPtrTest
    : public ViewsTestBase,
      public ::testing::WithParamInterface<Widget::InitParams::Ownership>,
      public ViewObserver {};

// Make sure explicitly resetting the |unique_widget_ptr| variable properly
// closes the widget. TearDown() will ensure |widget_| has been cleared.
TEST_P(UniqueWidgetPtrTest, TestCloseContent) {}

// Same as above, only testing that going out of scope will accomplish the same
// thing.
TEST_P(UniqueWidgetPtrTest, TestScopeDestruct) {}

// Check that proper move semantics for assignments work.
TEST_P(UniqueWidgetPtrTest, TestMoveAssign) {}

// Check that move construction functions correctly.
TEST_P(UniqueWidgetPtrTest, TestMoveConstruct) {}

// Make sure that any external closing of the widget is properly tracked in the
// |unique_widget_ptr|.
TEST_P(UniqueWidgetPtrTest, TestCloseWidget) {}

// When the NativeWidget is destroyed, ensure that the Widget is also destroyed
// which in turn clears the |unique_widget_ptr|.
TEST_P(UniqueWidgetPtrTest, TestCloseNativeWidget) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace views