Commit 7b862224 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Adds a DefaultToPersistent=true param to the Android Messages PWA.

Bug: 850823
Change-Id: I60bfe8c045da13daa6fd85214381b1ff39b7afcc
Reviewed-on: https://chromium-review.googlesource.com/c/1258609
Commit-Queue: Jon Mann <jonmann@chromium.org>
Reviewed-by: default avatarJeremy Klein <jlklein@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596425}
parent 1bbd7202
...@@ -26,9 +26,11 @@ const char kAndroidMessagesProdUrl[] = "https://messages.android.com/"; ...@@ -26,9 +26,11 @@ const char kAndroidMessagesProdUrl[] = "https://messages.android.com/";
// NOTE: Using experiment mods until changes roll out to prod. // NOTE: Using experiment mods until changes roll out to prod.
const char kExperimentUrlParams[] = const char kExperimentUrlParams[] =
"?e=DittoServiceWorker,DittoPwa,DittoIndexedDb"; "?e=DittoServiceWorker,DittoPwa,DittoIndexedDb&DefaultToPersistent=true";
GURL GetURLInternal(bool with_experiments) { const char kProdUrlParams[] = "?DefaultToPersistent=true";
GURL GetURLInternal(bool with_params) {
const base::CommandLine* command_line = const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess(); base::CommandLine::ForCurrentProcess();
std::string url_string = std::string url_string =
...@@ -39,19 +41,20 @@ GURL GetURLInternal(bool with_experiments) { ...@@ -39,19 +41,20 @@ GURL GetURLInternal(bool with_experiments) {
if (url_string.empty()) if (url_string.empty())
url_string = std::string(use_prod_url ? kAndroidMessagesProdUrl url_string = std::string(use_prod_url ? kAndroidMessagesProdUrl
: kAndroidMessagesSandboxUrl); : kAndroidMessagesSandboxUrl);
if (with_experiments) if (with_params)
url_string += std::string(kExperimentUrlParams); url_string +=
std::string(use_prod_url ? kProdUrlParams : kExperimentUrlParams);
return GURL(url_string); return GURL(url_string);
} }
} // namespace } // namespace
GURL GetAndroidMessagesURL() { GURL GetAndroidMessagesURL() {
return GetURLInternal(false /* with_experiments */); return GetURLInternal(false /* with_params */);
} }
GURL GetAndroidMessagesURLWithExperiments() { GURL GetAndroidMessagesURLWithParams() {
return GetURLInternal(true /* with_experiments */); return GetURLInternal(true /* with_params */);
} }
} // namespace android_sms } // namespace android_sms
......
...@@ -15,9 +15,11 @@ namespace android_sms { ...@@ -15,9 +15,11 @@ namespace android_sms {
GURL GetAndroidMessagesURL(); GURL GetAndroidMessagesURL();
// Returns URL to Android Messages for Web page used by AndroidSmsService. // Returns URL to Android Messages for Web page used by AndroidSmsService.
// Includes the experiment URL params for the ChromeOS integrations. // This includes a URL param indicating that it should default to persist the
// This is temporary for dogfood until these flags are rolled out to prod. // connection. If still using the sandbox URL, this will also include the
GURL GetAndroidMessagesURLWithExperiments(); // experiment URL params for the ChromeOS integrations. This is temporary for
// dogfood until these flags are rolled out to prod.
GURL GetAndroidMessagesURLWithParams();
} // namespace android_sms } // namespace android_sms
......
...@@ -51,7 +51,7 @@ void AndroidSmsAppHelperDelegateImpl::InstallAndroidSmsApp( ...@@ -51,7 +51,7 @@ void AndroidSmsAppHelperDelegateImpl::InstallAndroidSmsApp(
// can easily fail. // can easily fail.
pending_app_manager_->Install( pending_app_manager_->Install(
web_app::PendingAppManager::AppInfo( web_app::PendingAppManager::AppInfo(
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(), chromeos::android_sms::GetAndroidMessagesURLWithParams(),
web_app::PendingAppManager::LaunchContainer::kWindow, web_app::PendingAppManager::LaunchContainer::kWindow,
web_app::PendingAppManager::InstallSource::kInternal, web_app::PendingAppManager::InstallSource::kInternal,
web_app::PendingAppManager::AppInfo::kDefaultCreateShortcuts, web_app::PendingAppManager::AppInfo::kDefaultCreateShortcuts,
......
...@@ -79,7 +79,7 @@ TEST_F(AndroidSmsAppHelperDelegateImplTest, TestInstallMessagesApp) { ...@@ -79,7 +79,7 @@ TEST_F(AndroidSmsAppHelperDelegateImplTest, TestInstallMessagesApp) {
std::vector<web_app::PendingAppManager::AppInfo> expected_apps_to_install; std::vector<web_app::PendingAppManager::AppInfo> expected_apps_to_install;
expected_apps_to_install.emplace_back( expected_apps_to_install.emplace_back(
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(), chromeos::android_sms::GetAndroidMessagesURLWithParams(),
web_app::PendingAppManager::LaunchContainer::kWindow, web_app::PendingAppManager::LaunchContainer::kWindow,
web_app::PendingAppManager::InstallSource::kInternal, web_app::PendingAppManager::InstallSource::kInternal,
web_app::PendingAppManager::AppInfo::kDefaultCreateShortcuts, web_app::PendingAppManager::AppInfo::kDefaultCreateShortcuts,
......
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