Commit 68bd8c75 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS MultiDevice] Add metric for Messages PWA uninstallation.

This metric measures the boolean success/failure result of the app
uninstallation.

Bug: 917855
Change-Id: Iad12046f28b647cf58cb6f22aa6862ff086204ef
Reviewed-on: https://chromium-review.googlesource.com/c/1392011Reviewed-by: default avatarJeremy Klein <jlklein@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619832}
parent dd6585b5
......@@ -38,11 +38,12 @@ network::mojom::CookieManager* GetCookieManager(Profile* profile) {
}
void OnAppUninstallResult(const GURL& app_url, bool succeeded) {
UMA_HISTOGRAM_BOOLEAN("AndroidSms.PWAUninstallationResult", succeeded);
if (succeeded)
return;
PA_LOG(ERROR) << "Failed to uninstall messages app; URL: " << app_url;
// TODO(khorimoto): Add metrics for failed uninstallations.
}
} // namespace
......
......@@ -248,6 +248,8 @@ TEST_F(AndroidSmsAppHelperDelegateImplTest, TestInstallMessagesApp_NoOldApp) {
TEST_F(AndroidSmsAppHelperDelegateImplTest,
TestInstallMessagesApp_UninstallsOldApp) {
base::HistogramTester histogram_tester;
// Simulate a PWA having already been installed at the old URL.
test_pwa_fetcher_delegate()->SetHasPwa(
android_sms::GetAndroidMessagesURLOld(), true /* has_pwa */);
......@@ -258,6 +260,8 @@ TEST_F(AndroidSmsAppHelperDelegateImplTest,
ASSERT_EQ(1u, test_pending_app_manager()->uninstall_requests().size());
EXPECT_EQ(android_sms::GetAndroidMessagesURLOld(),
test_pending_app_manager()->uninstall_requests()[0]);
histogram_tester.ExpectBucketCount("AndroidSms.PWAUninstallationResult",
true /* success */, 1);
// The old app's cookie should have been deleted.
VerifyCookieDeletedForUrl(android_sms::GetAndroidMessagesURLOld());
......
......@@ -2923,6 +2923,16 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="AndroidSms.PWAUninstallationResult" enum="BooleanSuccess">
<owner>azeemarshad@chromium.org</owner>
<owner>hansberry@chromium.org</owner>
<summary>
Records success/failure for when Android Messages for Web PWA is
uninstalled. The PWA is uninstalled when the messages URL changes, resulting
in the PWA being uninstalled at the old URL and reinstalled at the new URL.
</summary>
</histogram>
<histogram name="AndroidSms.ServiceWorkerLifetime" units="ms">
<owner>azeemarshad@chromium.org</owner>
<summary>
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