| Index: ash/common/wm/container_finder_unittest.cc
|
| diff --git a/ash/common/wm/container_finder_unittest.cc b/ash/common/wm/container_finder_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cc814c368e1985b55796342de527a9b342f0fdc3
|
| --- /dev/null
|
| +++ b/ash/common/wm/container_finder_unittest.cc
|
| @@ -0,0 +1,35 @@
|
| +// Copyright 2016 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/common/wm/container_finder.h"
|
| +
|
| +#include <memory>
|
| +
|
| +#include "ash/common/shell_window_ids.h"
|
| +#include "ash/common/wm_lookup.h"
|
| +#include "ash/common/wm_window.h"
|
| +#include "ash/test/ash_test_base.h"
|
| +#include "ui/gfx/geometry/rect.h"
|
| +#include "ui/views/widget/widget.h"
|
| +
|
| +namespace ash {
|
| +
|
| +using ContainerFinderTest = test::AshTestBase;
|
| +
|
| +TEST_F(ContainerFinderTest, GetContainerForWindow) {
|
| + // Create a normal widget in the default container.
|
| + std::unique_ptr<views::Widget> widget = CreateTestWidget(
|
| + nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4));
|
| + WmWindow* window = WmLookup::Get()->GetWindowForWidget(widget.get());
|
| +
|
| + // The window itself is not a container.
|
| + EXPECT_EQ(kShellWindowId_Invalid, window->GetShellWindowId());
|
| +
|
| + // Container lookup finds the default container.
|
| + WmWindow* container = wm::GetContainerForWindow(window);
|
| + ASSERT_TRUE(container);
|
| + EXPECT_EQ(kShellWindowId_DefaultContainer, container->GetShellWindowId());
|
| +}
|
| +
|
| +} // namespace ash
|
|
|