ceftests: mac: Wait for fullscreen window destruction (see #3188)
This commit is contained in:
parent
6459917c0a
commit
e44d33d5bf
|
@ -193,8 +193,15 @@ void TestWindowDelegate::OnWindowFullscreenTransition(
|
|||
fullscreen_transition_callback_count_++;
|
||||
|
||||
#if defined(OS_MAC)
|
||||
// Two callbacks on MacOS.
|
||||
EXPECT_EQ(is_completed ? 2U : 1U, fullscreen_transition_callback_count_);
|
||||
// Only one callback when window is initially shown fullscreen on MacOS.
|
||||
if (config_->initial_show_state == CEF_SHOW_STATE_FULLSCREEN &&
|
||||
fullscreen_transition_complete_count_ == 0) {
|
||||
EXPECT_TRUE(is_completed);
|
||||
EXPECT_EQ(1U, fullscreen_transition_callback_count_);
|
||||
} else {
|
||||
// Two callbacks otherwise.
|
||||
EXPECT_EQ(is_completed ? 2U : 1U, fullscreen_transition_callback_count_);
|
||||
}
|
||||
#else
|
||||
// Single callback on other platforms.
|
||||
EXPECT_TRUE(is_completed);
|
||||
|
|
|
@ -145,11 +145,36 @@ void WindowCreateMaximizedImpl(CefRefPtr<CefWaitableEvent> event) {
|
|||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
#if defined(OS_MAC)
|
||||
void WindowFullscreenCreationComplete(CefRefPtr<CefWindow> window,
|
||||
size_t count) {
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
EXPECT_EQ(window->IsFullscreen(), window->IsMaximized());
|
||||
|
||||
if (window->IsFullscreen()) {
|
||||
EXPECT_EQ(1U, count);
|
||||
window->SetFullscreen(false);
|
||||
} else {
|
||||
EXPECT_EQ(2U, count);
|
||||
// End the test by closing the Window.
|
||||
window->Close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void WindowCreateFullscreenImpl(CefRefPtr<CefWaitableEvent> event) {
|
||||
auto config = std::make_unique<TestWindowDelegate::Config>();
|
||||
config->initial_show_state = CEF_SHOW_STATE_FULLSCREEN;
|
||||
config->on_window_created =
|
||||
base::BindOnce(RunWindowShow, config->initial_show_state);
|
||||
#if defined(OS_MAC)
|
||||
// On macOS, destroying a fullscreen window can take a long time.
|
||||
// To prevent the next test from starting before the window is fully closed,
|
||||
// we need to exit fullscreen mode before closing the window.
|
||||
config->on_window_fullscreen_transition_complete =
|
||||
base::BindRepeating(WindowFullscreenCreationComplete);
|
||||
config->close_window = false;
|
||||
#endif
|
||||
TestWindowDelegate::RunTest(event, std::move(config));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue