forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lacros: Close splash screen window after the main window is ready
During the kiosk session startup, a splash screen is displayed which shows the current initialization status. After the main application window (at the lacros side) is ready, the splash window (at the ash side) should be closed. Current challenge is to know when the main application window is ready. This CL solves it as follows: 1. Ash uses exo::WMHelper to observe the creation of lacros window. 2. Once the lacros window is created and OnExoWindowCreated is triggered, close the splash window by calling delegate_->OnAppWindowCreated(). Bug: 1232794 Change-Id: I30d40aad7a35069034b7f1cf0838ef427eef699f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3170393 Commit-Queue: Anqing Zhao <[email protected]> Reviewed-by: Anatoliy Potapchuk <[email protected]> Reviewed-by: Nancy Wang <[email protected]> Cr-Commit-Position: refs/heads/main@{#930288}
- Loading branch information
ananubis
authored and
Chromium LUCI CQ
committed
Oct 11, 2021
1 parent
725be80
commit 77a03cc
Showing
3 changed files
with
33 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
#include "chrome/test/base/test_browser_window.h" | ||
#include "chrome/test/base/testing_browser_process.h" | ||
#include "chrome/test/base/testing_profile.h" | ||
#include "components/exo/shell_surface_util.h" | ||
#include "components/exo/wm_helper_chromeos.h" | ||
#include "components/user_manager/scoped_user_manager.h" | ||
#include "content/public/test/browser_task_environment.h" | ||
#include "testing/gmock/include/gmock/gmock.h" | ||
|
@@ -56,6 +58,7 @@ const char kAppEmail[] = "[email protected]"; | |
const char kAppInstallUrl[] = "https://example.com"; | ||
const char kAppLaunchUrl[] = "https://example.com/launch"; | ||
const char kAppLaunchBadUrl[] = "https://badexample.com"; | ||
const char kLacrosAppId[] = "org.chromium.lacros.12345"; | ||
const char kUserEmail[] = "[email protected]"; | ||
const char16_t kAppTitle[] = u"app"; | ||
|
||
|
@@ -365,7 +368,8 @@ class WebKioskAppLauncherUsingLacrosTest : public WebKioskAppLauncherTest { | |
WebKioskAppLauncherUsingLacrosTest() | ||
: browser_manager_(std::make_unique<crosapi::FakeBrowserManager>()), | ||
fake_user_manager_(new ash::FakeChromeUserManager()), | ||
scoped_user_manager_(base::WrapUnique(fake_user_manager_)) { | ||
scoped_user_manager_(base::WrapUnique(fake_user_manager_)), | ||
wm_helper_(std::make_unique<exo::WMHelperChromeOS>()) { | ||
scoped_feature_list_.InitAndEnableFeature(features::kWebKioskEnableLacros); | ||
crosapi::browser_util::SetLacrosEnabledForTest(true); | ||
crosapi::browser_util::SetLacrosPrimaryBrowserForTest(true); | ||
|
@@ -377,6 +381,13 @@ class WebKioskAppLauncherUsingLacrosTest : public WebKioskAppLauncherTest { | |
fake_user_manager()->LoginUser(account_id); | ||
} | ||
|
||
void CreateLacrosWindowAndNotify() { | ||
auto window = std::make_unique<aura::Window>(nullptr); | ||
window->Init(ui::LAYER_SOLID_COLOR); | ||
exo::SetShellApplicationId(window.get(), kLacrosAppId); | ||
wm_helper()->NotifyExoWindowCreated(window.get()); | ||
} | ||
|
||
crosapi::FakeBrowserManager* browser_manager() const { | ||
return browser_manager_.get(); | ||
} | ||
|
@@ -385,11 +396,14 @@ class WebKioskAppLauncherUsingLacrosTest : public WebKioskAppLauncherTest { | |
return fake_user_manager_; | ||
} | ||
|
||
exo::WMHelper* wm_helper() const { return wm_helper_.get(); } | ||
|
||
private: | ||
base::test::ScopedFeatureList scoped_feature_list_; | ||
std::unique_ptr<crosapi::FakeBrowserManager> browser_manager_; | ||
ash::FakeChromeUserManager* fake_user_manager_; | ||
user_manager::ScopedUserManager scoped_user_manager_; | ||
std::unique_ptr<exo::WMHelper> wm_helper_; | ||
}; | ||
|
||
TEST_F(WebKioskAppLauncherUsingLacrosTest, NormalFlow) { | ||
|
@@ -415,6 +429,7 @@ TEST_F(WebKioskAppLauncherUsingLacrosTest, NormalFlow) { | |
EXPECT_CALL(*delegate(), OnLaunchFailed(_)).Times(0); | ||
browser_manager()->set_is_running(true); | ||
launcher()->LaunchApp(); | ||
CreateLacrosWindowAndNotify(); | ||
loop2.Run(); | ||
} | ||
|
||
|
@@ -443,6 +458,7 @@ TEST_F(WebKioskAppLauncherUsingLacrosTest, WaitBrowserManagerToRun) { | |
launcher()->LaunchApp(); | ||
browser_manager()->set_is_running(true); | ||
browser_manager()->StartRunning(); | ||
CreateLacrosWindowAndNotify(); | ||
loop2.Run(); | ||
} | ||
|
||
|