This source file includes following definitions.
- CheckAlwaysOnTopToFullscreen
- CheckNormalToFullscreen
- CheckFullscreenToAlwaysOnTop
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "apps/ui/native_app_window.h"
#include "chrome/browser/apps/app_browsertest_util.h"
using extensions::PlatformAppBrowserTest;
using extensions::Extension;
namespace apps {
namespace {
class AppWindowTest : public PlatformAppBrowserTest {
protected:
void CheckAlwaysOnTopToFullscreen(AppWindow* window) {
ASSERT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
window->Fullscreen();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
EXPECT_TRUE(window->IsAlwaysOnTop());
window->Restore();
EXPECT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
}
void CheckNormalToFullscreen(AppWindow* window) {
ASSERT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
window->Fullscreen();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
window->Restore();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
}
void CheckFullscreenToAlwaysOnTop(AppWindow* window) {
ASSERT_TRUE(window->GetBaseWindow()->IsFullscreenOrPending());
window->SetAlwaysOnTop(true);
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
EXPECT_TRUE(window->IsAlwaysOnTop());
window->Restore();
EXPECT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
}
};
}
#if defined(OS_MACOSX)
#define MAYBE_InitAlwaysOnTopToFullscreen DISABLED_InitAlwaysOnTopToFullscreen
#else
#define MAYBE_InitAlwaysOnTopToFullscreen InitAlwaysOnTopToFullscreen
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitAlwaysOnTopToFullscreen) {
AppWindow* window = CreateTestAppWindow("{ \"alwaysOnTop\": true }");
ASSERT_TRUE(window);
CheckAlwaysOnTopToFullscreen(window);
window->SetAlwaysOnTop(false);
CheckNormalToFullscreen(window);
CloseAppWindow(window);
}
#if defined(OS_MACOSX)
#define MAYBE_RuntimeAlwaysOnTopToFullscreen \
DISABLED_RuntimeAlwaysOnTopToFullscreen
#else
#define MAYBE_RuntimeAlwaysOnTopToFullscreen RuntimeAlwaysOnTopToFullscreen
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_RuntimeAlwaysOnTopToFullscreen) {
AppWindow* window = CreateTestAppWindow("{}");
ASSERT_TRUE(window);
CheckNormalToFullscreen(window);
window->SetAlwaysOnTop(true);
CheckAlwaysOnTopToFullscreen(window);
CloseAppWindow(window);
}
#if defined(OS_MACOSX)
#define MAYBE_InitFullscreenToAlwaysOnTop DISABLED_InitFullscreenToAlwaysOnTop
#else
#define MAYBE_InitFullscreenToAlwaysOnTop InitFullscreenToAlwaysOnTop
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitFullscreenToAlwaysOnTop) {
AppWindow* window = CreateTestAppWindow("{ \"state\": \"fullscreen\" }");
ASSERT_TRUE(window);
CheckFullscreenToAlwaysOnTop(window);
CloseAppWindow(window);
}
#if defined(OS_MACOSX)
#define MAYBE_RuntimeFullscreenToAlwaysOnTop \
DISABLED_RuntimeFullscreenToAlwaysOnTop
#else
#define MAYBE_RuntimeFullscreenToAlwaysOnTop RuntimeFullscreenToAlwaysOnTop
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_RuntimeFullscreenToAlwaysOnTop) {
AppWindow* window = CreateTestAppWindow("{}");
ASSERT_TRUE(window);
window->Fullscreen();
CheckFullscreenToAlwaysOnTop(window);
CloseAppWindow(window);
}
#if defined(OS_MACOSX)
#define MAYBE_InitFullscreenAndAlwaysOnTop DISABLED_InitFullscreenAndAlwaysOnTop
#else
#define MAYBE_InitFullscreenAndAlwaysOnTop InitFullscreenAndAlwaysOnTop
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_InitFullscreenAndAlwaysOnTop) {
AppWindow* window = CreateTestAppWindow(
"{ \"alwaysOnTop\": true, \"state\": \"fullscreen\" }");
ASSERT_TRUE(window);
EXPECT_TRUE(window->GetBaseWindow()->IsFullscreenOrPending());
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
EXPECT_TRUE(window->IsAlwaysOnTop());
window->Restore();
EXPECT_TRUE(window->GetBaseWindow()->IsAlwaysOnTop());
CloseAppWindow(window);
}
#if defined(OS_MACOSX)
#define MAYBE_DisableAlwaysOnTopInFullscreen \
DISABLED_DisableAlwaysOnTopInFullscreen
#else
#define MAYBE_DisableAlwaysOnTopInFullscreen DisableAlwaysOnTopInFullscreen
#endif
IN_PROC_BROWSER_TEST_F(AppWindowTest, MAYBE_DisableAlwaysOnTopInFullscreen) {
AppWindow* window = CreateTestAppWindow("{ \"alwaysOnTop\": true }");
ASSERT_TRUE(window);
window->Fullscreen();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
window->SetAlwaysOnTop(false);
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
window->Restore();
EXPECT_FALSE(window->GetBaseWindow()->IsAlwaysOnTop());
CloseAppWindow(window);
}
}