Skip to content

Commit

Permalink
[dPWA Testing] Add InstallMode parameter to InstallPolicyApp action
Browse files Browse the repository at this point in the history
Enables Web App integration tests to exercise the install_as_shortcut
property of the WebAppInstallForceList preference.

Coined the term WebShortcut to avoid confusion with the existing "desktop shortcut" concept. "shortcut" by itself would be rather ambiguous.

Bug: 1216457
Change-Id: I864899940bf5d1f16bc69c86fc6fafdc339e6e9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3894293
Reviewed-by: Daniel Murphy <dmurph@chromium.org>
Commit-Queue: Daniel d'Andrada <dandrader@google.com>
Cr-Commit-Position: refs/heads/main@{#1048520}
  • Loading branch information
dandrader authored and Chromium LUCI CQ committed Sep 19, 2022
1 parent bca7ddc commit a0b59c3
Show file tree
Hide file tree
Showing 11 changed files with 5,152 additions and 5,157 deletions.
3,942 changes: 1,974 additions & 1,968 deletions chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1009,15 +1009,17 @@ void WebAppIntegrationTestDriver::InstallOmniboxIcon(InstallableSite site) {

void WebAppIntegrationTestDriver::InstallPolicyApp(Site site,
ShortcutOptions shortcut,
WindowOptions window) {
WindowOptions window,
InstallMode mode) {
if (!BeforeStateChangeAction(__FUNCTION__))
return;
base::Value container = base::Value(window == WindowOptions::kWindowed
? kDefaultLaunchContainerWindowValue
: kDefaultLaunchContainerTabValue);
InstallPolicyAppInternal(
site, std::move(container),
/*create_shortcut=*/shortcut == ShortcutOptions::kWithShortcut);
/*create_shortcut=*/shortcut == ShortcutOptions::kWithShortcut,
/*install_as_shortcut=*/mode == InstallMode::kWebShortcut);
AfterStateChangeAction();
}

Expand Down Expand Up @@ -2730,7 +2732,8 @@ base::FilePath WebAppIntegrationTestDriver::GetShortcutPath(
void WebAppIntegrationTestDriver::InstallPolicyAppInternal(
Site site,
base::Value default_launch_container,
const bool create_shortcut) {
const bool create_shortcut,
const bool install_as_shortcut) {
GURL url = GetAppStartURL(site);
WebAppTestInstallWithOsHooksObserver observer(profile());
observer.BeginListening();
Expand All @@ -2739,6 +2742,7 @@ void WebAppIntegrationTestDriver::InstallPolicyAppInternal(
item.Set(kUrlKey, url.spec());
item.Set(kDefaultLaunchContainerKey, std::move(default_launch_container));
item.Set(kCreateDesktopShortcutKey, create_shortcut);
item.Set(kInstallAsShortcut, install_as_shortcut);
ListPrefUpdate update(profile()->GetPrefs(),
prefs::kWebAppInstallForceList);
update->GetList().Append(std::move(item));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ enum class WindowOptions { kWindowed, kBrowser };

enum class ShortcutOptions { kWithShortcut, kNoShortcut };

enum class InstallMode { kWebApp, kWebShortcut };

enum class AllowDenyOptions { kAllow, kDeny };

enum class AskAgainOptions { kAskAgain, kRemember };
Expand Down Expand Up @@ -223,7 +225,8 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {
void InstallOmniboxIcon(InstallableSite site);
void InstallPolicyApp(Site site,
ShortcutOptions shortcut,
WindowOptions window);
WindowOptions window,
InstallMode mode);
// These functions install apps which are tabbed and creates shortcuts.
void ApplyRunOnOsLoginPolicyAllowed(Site site);
void ApplyRunOnOsLoginPolicyBlocked(Site site);
Expand Down Expand Up @@ -338,7 +341,8 @@ class WebAppIntegrationTestDriver : WebAppInstallManagerObserver {

void InstallPolicyAppInternal(Site site,
base::Value default_launch_container,
bool create_shortcut);
const bool create_shortcut,
const bool install_as_shortcut);
void ApplyRunOnOsLoginPolicy(Site site, const char* policy);

void UninstallPolicyAppById(const AppId& id);
Expand Down
1,021 changes: 510 additions & 511 deletions chrome/test/webapps/coverage/coverage_cros.tsv

Large diffs are not rendered by default.

1,155 changes: 577 additions & 578 deletions chrome/test/webapps/coverage/coverage_linux.tsv

Large diffs are not rendered by default.

1,155 changes: 577 additions & 578 deletions chrome/test/webapps/coverage/coverage_mac.tsv

Large diffs are not rendered by default.

1,155 changes: 577 additions & 578 deletions chrome/test/webapps/coverage/coverage_win.tsv

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions chrome/test/webapps/data/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ TODO(dmurph): Possibly this table up into markdown-header section.
| # Install |
| install_locally | Site | | 46 | Implemented | Find the app in the app list (chrome://apps) and install it by right-clicking on the app and selecting the 'install' option. Win/Mac/Linux only. | |
| install_omnibox_icon | InstallableSite | | 31 | Implemented | | |
| install_policy_app | Site, ShortcutOptions, WindowOptions | | 32 | Implemented | Add a force-installed enterprise policy site to the user profile (must be managed profile). | |
| install_policy_app | Site, ShortcutOptions, WindowOptions, InstallMode | | 32 | Implemented | Add a force-installed enterprise policy site to the user profile (must be managed profile). | |
| install_menu_option | InstallableSite | | 47 | Implemented | | |
| install_no_shortcut | Site | install_policy_app($1, NoShortcut, WindowOptions::All) | 56 | Parameterized | | |
| install_tabbed_no_shortcut | Site | install_policy_app($1, NoShortcut, Browser) | 129 | Parameterized | All installation methods that result in a tabbed webapp without shortcut. | |
| install_windowed_no_shortcut | Site | install_policy_app($1, NoShortcut, Windowed) | 131 | Parameterized | All installation methods that result in a windowed webapp without shortcut. | |
| install_no_shortcut | Site | install_policy_app($1, NoShortcut, WindowOptions::All, WebApp) | 56 | Parameterized | | |
| install_tabbed_no_shortcut | Site | install_policy_app($1, NoShortcut, Browser, WebApp) | 129 | Parameterized | All installation methods that result in a tabbed webapp without shortcut. | |
| install_windowed_no_shortcut | Site | install_policy_app($1, NoShortcut, Windowed, WebApp) | 131 | Parameterized | All installation methods that result in a windowed webapp without shortcut. | |
| # Install & Create Shortcut Parameterized |
| install_or_shortcut | Site | create_shortcut($1, WindowOptions::All) & install_omnibox_icon($1) & install_policy_app($1, ShortcutOptions::All, WindowOptions::All) & install_menu_option($1) | 52 | Parameterized | | |
| install_or_shortcut | Site | create_shortcut($1, WindowOptions::All) & install_omnibox_icon($1) & install_policy_app($1, ShortcutOptions::All, WindowOptions::All, WebApp) & install_menu_option($1) | 52 | Parameterized | | |
| install_or_shortcut_by_user | Site | create_shortcut($1, WindowOptions::All) & install_omnibox_icon($1) & install_menu_option($1) | 53 | Parameterized | | |
| install_or_shortcut_by_user_tabbed | Site | create_shortcut($1, Browser) | 54 | Parameterized | | |
| install_or_shortcut_by_user_windowed | Site | create_shortcut($1, Windowed) & install_omnibox_icon($1) & install_menu_option($1) | 55 | Parameterized | | |
| install_or_shortcut_tabbed | Site | create_shortcut($1, Browser) & install_policy_app($1, ShortcutOptions::All, Browser) | 61 | Parameterized | All installation methods that result in a tabbed webapp. | |
| install_or_shortcut_tabbed | Site | create_shortcut($1, Browser) & install_policy_app($1, ShortcutOptions::All, Browser, WebApp) | 61 | Parameterized | All installation methods that result in a tabbed webapp. | |
| install_or_shortcut_tabbed_with_shortcut | Site | create_shortcut($1, Browser) & install_policy_app($1, WithShortcut, Browser) | 128 | Parameterized | All installation methods that result in a tabbed webapp with shortcut created. | |
| install_or_shortcut_windowed | Site | create_shortcut($1, Windowed) & install_omnibox_icon($1) & install_policy_app($1, ShortcutOptions::All, Windowed) & install_menu_option($1) | 62 | Parameterized | All installation methods that result in a windowed webapp. | |
| install_or_shortcut_windowed_with_shortcut | Site | create_shortcut($1, Windowed) & install_omnibox_icon($1) & install_policy_app($1, WithShortcut, Windowed) & install_menu_option($1) | 130 | Parameterized | All installation methods that result in a windowed webapp with shortcut created. | |
| install_or_shortcut_with_shortcut | Site | install_policy_app($1, WithShortcut, WindowOptions::All) & create_shortcut($1, WindowOptions::All) & install_omnibox_icon($1) & install_menu_option($1) | 63 | Parameterized | | |
| install_or_shortcut_windowed | Site | create_shortcut($1, Windowed) & install_omnibox_icon($1) & install_policy_app($1, ShortcutOptions::All, Windowed, WebApp) & install_menu_option($1) | 62 | Parameterized | All installation methods that result in a windowed webapp. | |
| install_or_shortcut_windowed_with_shortcut | Site | create_shortcut($1, Windowed) & install_omnibox_icon($1) & install_policy_app($1, WithShortcut, Windowed, WebApp) & install_menu_option($1) | 130 | Parameterized | All installation methods that result in a windowed webapp with shortcut created. | |
| install_or_shortcut_with_shortcut | Site | install_policy_app($1, WithShortcut, WindowOptions::All, WebApp) & create_shortcut($1, WindowOptions::All) & install_omnibox_icon($1) & install_menu_option($1) | 63 | Parameterized | | |
| |
| # Uninstall |
| uninstall_from_os | Site | | 87 | Implemented | Uninstalls the app from OS integration - e.g. Windows Control Panel / Start menu | |
Expand Down
Loading

0 comments on commit a0b59c3

Please sign in to comment.