Commit 939730b5 authored by Jarryd's avatar Jarryd Committed by Chromium LUCI CQ

dPWA: Implement testing journey 5.

 * Add test case for journey 5
 * Implement |add_policy_app_internal_windowed| testing action
 * Implement |assert_display_mode_browser_internal| testing action
 * Implement |assert_display_mode_standalone_internal| testing action
 * Add getter for WebAppProvider

Bug: 1145224, 1156676, 1156708, 1156706
Change-Id: I64f2ce560a78dfb9973cca21d9e21c28dcddf40a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610045
Commit-Queue: Jarryd Goodman <jarrydg@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843730}
parent 77bda58d
...@@ -225,7 +225,9 @@ class WebAppIntegrationBrowserTest ...@@ -225,7 +225,9 @@ class WebAppIntegrationBrowserTest
// alphabetical order. // alphabetical order.
void ExecuteAction(const std::string& action_string) { void ExecuteAction(const std::string& action_string) {
if (action_string == "add_policy_app_internal_tabbed") { if (action_string == "add_policy_app_internal_tabbed") {
AddPolicyAppInternalTabbed(); AddPolicyAppInternal(base::Value(kDefaultLaunchContainerTabValue));
} else if (action_string == "add_policy_app_internal_windowed") {
AddPolicyAppInternal(base::Value(kDefaultLaunchContainerWindowValue));
} else if (action_string == "close_pwa") { } else if (action_string == "close_pwa") {
ClosePWA(); ClosePWA();
} else if (action_string == "install_create_shortcut_tabbed") { } else if (action_string == "install_create_shortcut_tabbed") {
...@@ -256,6 +258,10 @@ class WebAppIntegrationBrowserTest ...@@ -256,6 +258,10 @@ class WebAppIntegrationBrowserTest
AssertAppInListNotWindowed(); AssertAppInListNotWindowed();
} else if (action_string == "assert_app_not_in_list") { } else if (action_string == "assert_app_not_in_list") {
AssertAppNotInList(); AssertAppNotInList();
} else if (action_string == "assert_display_mode_standalone_internal") {
AssertDisplayModeStandaloneInternal();
} else if (action_string == "assert_display_mode_browser_internal") {
AssertDisplayModeBrowserInternal();
} else if (action_string == "assert_installable") { } else if (action_string == "assert_installable") {
AssertInstallable(); AssertInstallable();
} else if (action_string == "assert_install_icon_shown") { } else if (action_string == "assert_install_icon_shown") {
...@@ -277,7 +283,7 @@ class WebAppIntegrationBrowserTest ...@@ -277,7 +283,7 @@ class WebAppIntegrationBrowserTest
} }
// Automated Testing Actions // Automated Testing Actions
void AddPolicyAppInternalTabbed() { void AddPolicyAppInternal(base::Value default_launch_container) {
GURL url = GetInstallableAppURL(); GURL url = GetInstallableAppURL();
auto* web_app_registrar = auto* web_app_registrar =
WebAppProvider::Get(profile())->registrar().AsWebAppRegistrar(); WebAppProvider::Get(profile())->registrar().AsWebAppRegistrar();
...@@ -297,7 +303,7 @@ class WebAppIntegrationBrowserTest ...@@ -297,7 +303,7 @@ class WebAppIntegrationBrowserTest
base::Value item(base::Value::Type::DICTIONARY); base::Value item(base::Value::Type::DICTIONARY);
item.SetKey(kUrlKey, base::Value(url.spec())); item.SetKey(kUrlKey, base::Value(url.spec()));
item.SetKey(kDefaultLaunchContainerKey, item.SetKey(kDefaultLaunchContainerKey,
base::Value(kDefaultLaunchContainerTabValue)); std::move(default_launch_container));
ListPrefUpdate update(profile()->GetPrefs(), ListPrefUpdate update(profile()->GetPrefs(),
prefs::kWebAppInstallForceList); prefs::kWebAppInstallForceList);
update->Append(item.Clone()); update->Append(item.Clone());
...@@ -346,7 +352,7 @@ class WebAppIntegrationBrowserTest ...@@ -346,7 +352,7 @@ class WebAppIntegrationBrowserTest
} }
void LaunchInternal() { void LaunchInternal() {
auto* web_app_provider = WebAppProvider::Get(profile()); auto* web_app_provider = GetProvider();
AppRegistrar& app_registrar = web_app_provider->registrar(); AppRegistrar& app_registrar = web_app_provider->registrar();
DisplayMode display_mode = DisplayMode display_mode =
app_registrar.GetAppEffectiveDisplayMode(app_id_); app_registrar.GetAppEffectiveDisplayMode(app_id_);
...@@ -478,6 +484,16 @@ class WebAppIntegrationBrowserTest ...@@ -478,6 +484,16 @@ class WebAppIntegrationBrowserTest
EXPECT_FALSE(display_mode == blink::mojom::DisplayMode::kStandalone); EXPECT_FALSE(display_mode == blink::mojom::DisplayMode::kStandalone);
} }
void AssertAppNotInList() { EXPECT_FALSE(base::Contains(app_ids_, app_id_)); } void AssertAppNotInList() { EXPECT_FALSE(base::Contains(app_ids_, app_id_)); }
void AssertDisplayModeStandaloneInternal() {
EXPECT_EQ(GetProvider()->registrar().GetAppEffectiveDisplayMode(app_id_),
DisplayMode::kStandalone);
}
void AssertDisplayModeBrowserInternal() {
EXPECT_EQ(GetProvider()->registrar().GetAppEffectiveDisplayMode(app_id_),
DisplayMode::kBrowser);
}
void AssertInstallable() { EXPECT_TRUE(last_navigation_result_.installable); } void AssertInstallable() { EXPECT_TRUE(last_navigation_result_.installable); }
void AssertInstallIconShown() { void AssertInstallIconShown() {
...@@ -532,6 +548,7 @@ class WebAppIntegrationBrowserTest ...@@ -532,6 +548,7 @@ class WebAppIntegrationBrowserTest
Profile* profile() { return browser()->profile(); } Profile* profile() { return browser()->profile(); }
Browser* app_browser() { return app_browser_; } Browser* app_browser() { return app_browser_; }
WebAppProvider* GetProvider() { return WebAppProvider::Get(profile()); }
std::vector<std::string>& testing_actions() { return testing_actions_; } std::vector<std::string>& testing_actions() { return testing_actions_; }
PageActionIconView* pwa_install_view() { return pwa_install_view_; } PageActionIconView* pwa_install_view() { return pwa_install_view_; }
......
...@@ -14,3 +14,11 @@ navigate_installable, install_omnibox_or_menu, list_apps_internal, set_open_in_t ...@@ -14,3 +14,11 @@ navigate_installable, install_omnibox_or_menu, list_apps_internal, set_open_in_t
navigate_installable, install_omnibox_or_menu, list_apps_internal, set_open_in_tab_internal, navigate_browser_in_scope, assert_install_icon_shown navigate_installable, install_omnibox_or_menu, list_apps_internal, set_open_in_tab_internal, navigate_browser_in_scope, assert_install_icon_shown
Linux, Mac, Win | navigate_installable,install_omnibox_or_menu,launch_internal, uninstall_from_menu,navigate_browser_in_scope, assert_install_icon_shown,assert_launch_icon_not_shown, Linux, Mac, Win | navigate_installable,install_omnibox_or_menu,launch_internal, uninstall_from_menu,navigate_browser_in_scope, assert_install_icon_shown,assert_launch_icon_not_shown,
ChromeOS | navigate_installable,install_omnibox_or_menu,launch_internal, uninstall_internal,navigate_browser_in_scope, assert_install_icon_shown,assert_launch_icon_not_shown, ChromeOS | navigate_installable,install_omnibox_or_menu,launch_internal, uninstall_internal,navigate_browser_in_scope, assert_install_icon_shown,assert_launch_icon_not_shown,
# Journey 5
# TODO(https://crbug.com/1156344, https://crbug.com/1156680): s/add_policy_app_internal_windowed/user_signin, add_policy_app_windowed_shortcut/
# TODO(https://crbug.com/1156694): s/assert_display_mode_standalone_internal/list_apps, assert_app_in_list_windowed/
add_policy_app_internal_windowed, assert_display_mode_standalone_internal,
# Journey 11
# TODO(https://crbug.com/1156344, https://crbug.com/1156678): s/add_policy_app_internal_tabbed/user_signin, add_policy_app_tabbed_shortcut/
# TODO(https://crbug.com/1156693): s/assert_display_mode_browser_internal/list_apps, assert_app_in_list_tabbed/
add_policy_app_internal_tabbed, assert_display_mode_browser_internal,
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment