Skip to content

Commit

Permalink
Revert "DPWA: add run_on_os_login CUJs"
Browse files Browse the repository at this point in the history
This reverts commit 8377417.

Reason for revert: Mac tests failing on builders look related to this CL. 
https://ci.chromium.org/p/chromium/builders/ci/Mac11%20Tests
https://ci.chromium.org/p/chromium/builders/ci/mac11-arm64-rel-tests

crbug.com/1312572

Original change's description:
> DPWA: add run_on_os_login CUJs
>
> Enable run_on_os_login related actions and replace manual tests with
> auto-generated tests (40 tests). Also add a
> CheckUserCannotSetRunOnOsLogin check action and add app_settings state
> check during app state snapshotting.
>
> Bug: 1306860
> Change-Id: If2482a9565f870b0614f8b90ab80cbcdf61bcf96
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3558556
> Reviewed-by: Daniel Murphy <dmurph@chromium.org>
> Commit-Queue: Phillis Tang <phillis@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#987994}

Bug: 1306860
Change-Id: I7ce25dd60d679a22d3fa782d930b599b435870d8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3566419
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Owners-Override: Jeffrey Cohen <jeffreycohen@chromium.org>
Auto-Submit: Jeffrey Cohen <jeffreycohen@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#988099}
  • Loading branch information
Jeffrey Cohen authored and Chromium LUCI CQ committed Apr 1, 2022
1 parent 5bff12f commit 128672e
Show file tree
Hide file tree
Showing 16 changed files with 2,378 additions and 3,002 deletions.

Large diffs are not rendered by default.

95 changes: 33 additions & 62 deletions chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,14 @@ void WebAppIntegrationTestDriver::ClosePwa() {
AfterStateChangeAction();
}

void WebAppIntegrationTestDriver::DisableRunOnOsLogin(
void WebAppIntegrationTestDriver::DisableRunOnOSLogin(
const std::string& site_mode) {
BeforeStateChangeAction(__FUNCTION__);
SetRunOnOsLoginMode(site_mode, apps::RunOnOsLoginMode::kNotRun);
AfterStateChangeAction();
}

void WebAppIntegrationTestDriver::EnableRunOnOsLogin(
void WebAppIntegrationTestDriver::EnableRunOnOSLogin(
const std::string& site_mode) {
BeforeStateChangeAction(__FUNCTION__);
SetRunOnOsLoginMode(site_mode, apps::RunOnOsLoginMode::kWindowed);
Expand Down Expand Up @@ -946,24 +946,30 @@ void WebAppIntegrationTestDriver::OpenAppSettingsFromChromeApps(
}

void WebAppIntegrationTestDriver::CheckAppSettingsAppState(
Profile* profile,
const AppState& app_state) {
const std::string& site_mode) {
#if !BUILDFLAG(IS_CHROMEOS)
auto app_management_page_handler = CreateAppManagementPageHandler(profile);
BeforeStateCheckAction(__FUNCTION__);
absl::optional<AppState> app_state = GetAppBySiteMode(
after_state_change_action_state_.get(), profile(), site_mode);
ASSERT_TRUE(app_state.has_value())
<< "No app installed for site: " << site_mode;

auto app_management_page_handler = CreateAppManagementPageHandler(profile());

app_management::mojom::AppPtr app;
app_management_page_handler.GetApp(
app_state.id,
app_state->id,
base::BindLambdaForTesting([&](app_management::mojom::AppPtr result) {
app = std::move(result);
}));

EXPECT_EQ(app->id, app_state.id);
EXPECT_EQ(app->title.value(), app_state.name);
EXPECT_EQ(app->window_mode, app_state.window_mode);
EXPECT_EQ(app->id, app_state->id);
EXPECT_EQ(app->title.value(), app_state->name);
EXPECT_EQ(app->window_mode, app_state->window_mode);
ASSERT_TRUE(app->run_on_os_login.has_value());
EXPECT_EQ(app->run_on_os_login.value()->login_mode,
app_state.run_on_os_login_mode);
app_state->run_on_os_login_mode);
AfterStateCheckAction();
#else
NOTREACHED() << "Not implemented on Chrome OS.";
#endif
Expand Down Expand Up @@ -1652,7 +1658,7 @@ void WebAppIntegrationTestDriver::CheckNoToolbar() {
AfterStateCheckAction();
}

void WebAppIntegrationTestDriver::CheckRunOnOsLoginEnabled(
void WebAppIntegrationTestDriver::CheckRunOnOSLoginEnabled(
const std::string& site_mode) {
BeforeStateCheckAction(__FUNCTION__);
absl::optional<AppState> app_state = GetAppBySiteMode(
Expand Down Expand Up @@ -1682,7 +1688,7 @@ void WebAppIntegrationTestDriver::CheckRunOnOsLoginEnabled(
AfterStateCheckAction();
}

void WebAppIntegrationTestDriver::CheckRunOnOsLoginDisabled(
void WebAppIntegrationTestDriver::CheckRunOnOSLoginDisabled(
const std::string& site_mode) {
BeforeStateCheckAction(__FUNCTION__);
absl::optional<AppState> app_state = GetAppBySiteMode(
Expand Down Expand Up @@ -1712,37 +1718,6 @@ void WebAppIntegrationTestDriver::CheckRunOnOsLoginDisabled(
AfterStateCheckAction();
}

void WebAppIntegrationTestDriver::CheckUserCannotSetRunOnOsLogin(
const std::string& site_mode) {
#if !BUILDFLAG(IS_CHROMEOS)
BeforeStateCheckAction(__FUNCTION__);
absl::optional<AppState> app_state = GetAppBySiteMode(
after_state_change_action_state_.get(), profile(), site_mode);
ASSERT_TRUE(app_state);
auto app_management_page_handler = CreateAppManagementPageHandler(profile());

app_management::mojom::AppPtr app;
app_management_page_handler.GetApp(
app_state->id,
base::BindLambdaForTesting([&](app_management::mojom::AppPtr result) {
app = std::move(result);
}));

ASSERT_TRUE(app->run_on_os_login.has_value());
ASSERT_TRUE(app->run_on_os_login.value()->is_managed);
if (app_state->run_on_os_login_mode == apps::RunOnOsLoginMode::kWindowed) {
DisableRunOnOsLogin(site_mode);
CheckRunOnOsLoginEnabled(site_mode);
} else {
EnableRunOnOsLogin(site_mode);
CheckRunOnOsLoginDisabled(site_mode);
}
AfterStateCheckAction();
#else
NOTREACHED() << "Not implemented on Chrome OS.";
#endif
}

void WebAppIntegrationTestDriver::CheckUserDisplayModeInternal(
DisplayMode display_mode) {
BeforeStateCheckAction(__FUNCTION__);
Expand Down Expand Up @@ -2002,26 +1977,22 @@ WebAppIntegrationTestDriver::ConstructStateSnapshot() {
manifest_launcher_icon_filename = info.url.ExtractFileName();
}
}
auto state = AppState(
app_id, registrar.GetAppShortName(app_id),
registrar.GetAppScope(app_id),
web_app_publisher_helper.ConvertDisplayModeToWindowMode(
registrar.GetAppUserDisplayMode(app_id)),
web_app_publisher_helper.ConvertOsLoginMode(
registrar.GetAppRunOnOsLoginMode(app_id).value),
registrar.GetAppEffectiveDisplayMode(app_id),
registrar.GetAppUserDisplayMode(app_id),
manifest_launcher_icon_filename, registrar.IsLocallyInstalled(app_id),
IsShortcutAndIconCreated(profile, registrar.GetAppShortName(app_id),
app_id));
#if !BUILDFLAG(IS_CHROMEOS)
if (registrar.IsLocallyInstalled(app_id)) {
CheckAppSettingsAppState(profile, state);
}
#endif
app_state.emplace(app_id, state);
}

app_state.emplace(
app_id,
AppState(app_id, registrar.GetAppShortName(app_id),
registrar.GetAppScope(app_id),
web_app_publisher_helper.ConvertDisplayModeToWindowMode(
registrar.GetAppUserDisplayMode(app_id)),
web_app_publisher_helper.ConvertOsLoginMode(
registrar.GetAppRunOnOsLoginMode(app_id).value),
registrar.GetAppEffectiveDisplayMode(app_id),
registrar.GetAppUserDisplayMode(app_id),
manifest_launcher_icon_filename,
registrar.IsLocallyInstalled(app_id),
IsShortcutAndIconCreated(
profile, registrar.GetAppShortName(app_id), app_id)));
}
profile_state_map.emplace(
profile, ProfileState(std::move(browser_state), std::move(app_state)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {
void AcceptAppIdUpdateDialog();
void CloseCustomToolbar();
void ClosePwa();
void DisableRunOnOsLogin(const std::string& site_mode);
void EnableRunOnOsLogin(const std::string& site_mode);
void DisableRunOnOSLogin(const std::string& site_mode);
void EnableRunOnOSLogin(const std::string& site_mode);
void InstallCreateShortcutTabbed(const std::string& site_mode);
void InstallCreateShortcutWindowed(const std::string& site_mode);
void InstallMenuOption(const std::string& site_mode);
Expand Down Expand Up @@ -203,6 +203,7 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {
void CheckAppInListTabbed(const std::string& site_mode);
void CheckAppNavigationIsStartUrl();
void CheckBrowserNavigationIsAppSettings(const std::string& site_mode);
void CheckAppSettingsAppState(const std::string& site_mode);
void CheckAppNotInList(const std::string& site_mode);
void CheckAppIconSiteA(const std::string& color);
void CheckAppTitleSiteA(const std::string& title);
Expand All @@ -219,9 +220,8 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {
void CheckNoToolbar();
void CheckPlatformShortcutAndIcon(const std::string& site_mode);
void CheckPlatformShortcutNotExists(const std::string& site_mode);
void CheckRunOnOsLoginEnabled(const std::string& site_mode);
void CheckRunOnOsLoginDisabled(const std::string& site_mode);
void CheckUserCannotSetRunOnOsLogin(const std::string& site_mode);
void CheckRunOnOSLoginEnabled(const std::string& site_mode);
void CheckRunOnOSLoginDisabled(const std::string& site_mode);
void CheckUserDisplayModeInternal(DisplayMode display_mode);
void CheckWindowClosed();
void CheckWindowCreated();
Expand Down Expand Up @@ -290,8 +290,6 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {

void LaunchAppStartupBrowserCreator(const AppId& app_id);

void CheckAppSettingsAppState(Profile* profile, const AppState& app_state);

Browser* browser();
const net::EmbeddedTestServer* embedded_test_server();
Profile* profile() {
Expand Down

0 comments on commit 128672e

Please sign in to comment.