container_finder_unittest.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2016 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. #include "ash/wm/container_finder.h"
  5. #include <memory>
  6. #include "ash/public/cpp/shell_window_ids.h"
  7. #include "ash/test/ash_test_base.h"
  8. #include "ash/wm/desks/desks_util.h"
  9. #include "ui/aura/window.h"
  10. #include "ui/gfx/geometry/rect.h"
  11. #include "ui/views/widget/widget.h"
  12. namespace ash {
  13. using ContainerFinderTest = AshTestBase;
  14. TEST_F(ContainerFinderTest, GetContainerForWindow) {
  15. // Create a normal widget in the default container.
  16. std::unique_ptr<views::Widget> widget = CreateTestWidget(
  17. nullptr, desks_util::GetActiveDeskContainerId(), gfx::Rect(1, 2, 3, 4));
  18. aura::Window* window = widget->GetNativeWindow();
  19. // The window itself is not a container.
  20. EXPECT_EQ(kShellWindowId_Invalid, window->GetId());
  21. // Container lookup finds the default container.
  22. aura::Window* container = GetContainerForWindow(window);
  23. ASSERT_TRUE(container);
  24. EXPECT_EQ(desks_util::GetActiveDeskContainerId(), container->GetId());
  25. }
  26. } // namespace ash