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/";
// NOTE: Using experiment mods until changes roll out to prod.
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 =
base::CommandLine::ForCurrentProcess();
std::string url_string =
......@@ -39,19 +41,20 @@ GURL GetURLInternal(bool with_experiments) {
if (url_string.empty())
url_string = std::string(use_prod_url ? kAndroidMessagesProdUrl
: kAndroidMessagesSandboxUrl);
if (with_experiments)
url_string += std::string(kExperimentUrlParams);
if (with_params)
url_string +=
std::string(use_prod_url ? kProdUrlParams : kExperimentUrlParams);
return GURL(url_string);
}
} // namespace
GURL GetAndroidMessagesURL() {
return GetURLInternal(false /* with_experiments */);
return GetURLInternal(false /* with_params */);
}
GURL GetAndroidMessagesURLWithExperiments() {
return GetURLInternal(true /* with_experiments */);
GURL GetAndroidMessagesURLWithParams() {
return GetURLInternal(true /* with_params */);
}
} // namespace android_sms
......
......@@ -15,9 +15,11 @@ namespace android_sms {
GURL GetAndroidMessagesURL();
// Returns URL to Android Messages for Web page used by AndroidSmsService.
// Includes the experiment URL params for the ChromeOS integrations.
// This is temporary for dogfood until these flags are rolled out to prod.
GURL GetAndroidMessagesURLWithExperiments();
// This includes a URL param indicating that it should default to persist the
// connection. If still using the sandbox URL, this will also include the
// 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
......
......@@ -51,7 +51,7 @@ void AndroidSmsAppHelperDelegateImpl::InstallAndroidSmsApp(
// can easily fail.
pending_app_manager_->Install(
web_app::PendingAppManager::AppInfo(
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(),
chromeos::android_sms::GetAndroidMessagesURLWithParams(),
web_app::PendingAppManager::LaunchContainer::kWindow,
web_app::PendingAppManager::InstallSource::kInternal,
web_app::PendingAppManager::AppInfo::kDefaultCreateShortcuts,
......
......@@ -79,7 +79,7 @@ TEST_F(AndroidSmsAppHelperDelegateImplTest, TestInstallMessagesApp) {
std::vector<web_app::PendingAppManager::AppInfo> expected_apps_to_install;
expected_apps_to_install.emplace_back(
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(),
chromeos::android_sms::GetAndroidMessagesURLWithParams(),
web_app::PendingAppManager::LaunchContainer::kWindow,
web_app::PendingAppManager::InstallSource::kInternal,
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