#include "ash/wm/fullscreen_window_finder.h"
#include <memory>
#include "ash/test/ash_test_base.h"
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/mojom/window_show_state.mojom.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/rect.h"
namespace ash {
class FullscreenWindowFinderTest : public AshTestBase {
public:
FullscreenWindowFinderTest() = default;
FullscreenWindowFinderTest(const FullscreenWindowFinderTest&) = delete;
FullscreenWindowFinderTest& operator=(const FullscreenWindowFinderTest&) =
delete;
~FullscreenWindowFinderTest() override = default;
void SetUp() override {
AshTestBase::SetUp();
test_window_.reset(
CreateTestWindowInShell({.bounds = {100, 100, 200, 200}}));
}
void TearDown() override {
test_window_.reset();
AshTestBase::TearDown();
}
bool FullscreenWindowExists() const {
return nullptr != GetWindowForFullscreenModeForContext(test_window_.get());
}
protected:
std::unique_ptr<aura::Window> test_window_;
};
TEST_F(FullscreenWindowFinderTest, NonFullscreen) {
EXPECT_FALSE(FullscreenWindowExists());
}
TEST_F(FullscreenWindowFinderTest, RegularFullscreen) {
test_window_->SetProperty(aura::client::kShowStateKey,
ui::mojom::WindowShowState::kFullscreen);
EXPECT_TRUE(FullscreenWindowExists());
}
TEST_F(FullscreenWindowFinderTest, PinnedFullscreen) {
window_util::PinWindow(test_window_.get(), false);
EXPECT_TRUE(FullscreenWindowExists());
}
TEST_F(FullscreenWindowFinderTest, TrustedPinnedFullscreen) {
window_util::PinWindow(test_window_.get(), true);
EXPECT_TRUE(FullscreenWindowExists());
}
}