Commit a8d26f1d authored by Jeremy Klein's avatar Jeremy Klein Committed by Commit Bot

Use staging android messages URL until changes go to prod.

R=azeemarshad@chromium.org

Bug: 850823
Change-Id: If8779b18e39f498c75798b092816adb79b1a7bfb
Reviewed-on: https://chromium-review.googlesource.com/1180487
Commit-Queue: Jeremy Klein <jlklein@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584555}
parent 8e3abfb3
......@@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "chrome/browser/chromeos/android_sms/android_sms_urls.h"
#include <string>
#include "base/command_line.h"
#include "base/optional.h"
#include "chrome/browser/chromeos/android_sms/android_sms_switches.h"
......@@ -14,21 +17,38 @@ namespace android_sms {
namespace {
const char kDefaultAndroidMessagesUrl[] = "https://messages.android.com";
// NOTE: Using internal staging server until changes roll out to prod.
const char kDefaultAndroidMessagesUrl[] =
"https://android-messages-web.corp.google.com";
} // namespace
// NOTE: Using experiment mods until changes roll out to prod.
const char kExperimentUrlParams[] =
"/?e=DittoServiceWorker,DittoPwa,DittoIndexedDb";
GURL GetAndroidMessagesURL() {
GURL GetURLInternal(bool with_experiments) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
GURL android_messages_url(command_line->GetSwitchValueASCII(
switches::kAlternateAndroidMessagesUrl));
if (android_messages_url.is_empty()) {
android_messages_url = GURL(kDefaultAndroidMessagesUrl);
std::string url_string = std::string(kDefaultAndroidMessagesUrl);
if (with_experiments)
url_string += std::string(kExperimentUrlParams);
android_messages_url = GURL(url_string);
}
return android_messages_url;
}
} // namespace
GURL GetAndroidMessagesURL() {
return GetURLInternal(false /* with_experiments */);
}
GURL GetAndroidMessagesURLWithExperiments() {
return GetURLInternal(true /* with_experiments */);
}
} // namespace android_sms
} // namespace chromeos
......@@ -14,6 +14,11 @@ namespace android_sms {
// Returns URL to Android Messages for Web page used by AndroidSmsService.
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();
} // namespace android_sms
} // namespace chromeos
......
......@@ -35,7 +35,7 @@ void AndroidSmsAppInstallDelegateImpl::InstallAndroidSmsApp() {
// can easily fail.
pending_app_manager_->Install(
web_app::PendingAppManager::AppInfo(
chromeos::android_sms::GetAndroidMessagesURL(),
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(),
web_app::PendingAppManager::LaunchContainer::kWindow),
base::BindOnce(&AndroidSmsAppInstallDelegateImpl::OnAppInstalled,
weak_ptr_factory_.GetWeakPtr()));
......
......@@ -52,7 +52,7 @@ TEST_F(AndroidSmsAppInstallDelegateImplTest, TestInstallMessagesApp) {
std::vector<web_app::PendingAppManager::AppInfo> expected_apps_to_install;
expected_apps_to_install.emplace_back(
chromeos::android_sms::GetAndroidMessagesURL(),
chromeos::android_sms::GetAndroidMessagesURLWithExperiments(),
web_app::PendingAppManager::LaunchContainer::kWindow);
EXPECT_EQ(expected_apps_to_install,
test_pending_app_manager()->installed_apps());
......
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