Commit 5df1fb9a authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

Reland "AW UMA: integration tests for more metadata fields"

This is a reland of 011e523c

This removes an assert which is not true when DCHECKs are disabled
(in such a case, we do not log the is_instrumented_build proto at all).

Original change's description:
> AW UMA: integration tests for more metadata fields
>
> No change to production logic.
>
> This adds tests for already-implemented UMA proto fields. This
> intentionally skips fields which don't apply to Android OS (ex.
> os.is_jailbroken, os.arc, os.kernel_version).
>
> Bug: 1011991
> Test: run_webview_instrumentation_test_apk -f AwMetricsMetadataTest.*
> Change-Id: I35fe2b75164a421a9a5dbc80df621f75ec9b5474
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1889171
> Auto-Submit: Nate Fischer <ntfschr@chromium.org>
> Reviewed-by: Changwan Ryu <changwan@chromium.org>
> Commit-Queue: Nate Fischer <ntfschr@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#710655}

Bug: 1011991
Change-Id: Ib0ac14fb25b8a61833f32c1df36f2719c060b4f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1891430
Auto-Submit: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711453}
parent a7dfd014
...@@ -22,6 +22,7 @@ import org.chromium.base.test.util.CommandLineFlags; ...@@ -22,6 +22,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.components.metrics.ChromeUserMetricsExtensionProtos.ChromeUserMetricsExtension; import org.chromium.components.metrics.ChromeUserMetricsExtensionProtos.ChromeUserMetricsExtension;
import org.chromium.components.metrics.MetricsSwitches; import org.chromium.components.metrics.MetricsSwitches;
import org.chromium.components.metrics.SystemProfileProtos.SystemProfileProto;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
...@@ -109,4 +110,42 @@ public class AwMetricsMetadataTest { ...@@ -109,4 +110,42 @@ public class AwMetricsMetadataTest {
Assert.assertTrue("Should have some client_id", log.hasClientId()); Assert.assertTrue("Should have some client_id", log.hasClientId());
Assert.assertTrue("Should have some session_id", log.hasSessionId()); Assert.assertTrue("Should have some session_id", log.hasSessionId());
} }
@Test
@MediumTest
@Feature({"AndroidWebView"})
public void testMetadata_buildInfo() throws Throwable {
ChromeUserMetricsExtension log = mPlatformServiceBridge.waitForNextMetricsLog();
SystemProfileProto systemProfile = log.getSystemProfile();
Assert.assertTrue("Should have some build_timestamp", systemProfile.hasBuildTimestamp());
Assert.assertTrue("Should have some app_version", systemProfile.hasAppVersion());
Assert.assertTrue("Should have some channel", systemProfile.hasChannel());
}
@Test
@MediumTest
@Feature({"AndroidWebView"})
public void testMetadata_miscellaneousSystemProfileInfo() throws Throwable {
ChromeUserMetricsExtension log = mPlatformServiceBridge.waitForNextMetricsLog();
SystemProfileProto systemProfile = log.getSystemProfile();
// TODO(ntfschr): assert UMA enabled date when https://crbug.com/995544 is resolved.
Assert.assertTrue("Should have some install_date", systemProfile.hasInstallDate());
// Don't assert application_locale's value, because we don't want to enforce capitalization
// requirements on the metrics service (ex. in case it switches from "en-US" to "en-us" for
// some reason).
Assert.assertTrue(
"Should have some application_locale", systemProfile.hasApplicationLocale());
}
@Test
@MediumTest
@Feature({"AndroidWebView"})
public void testMetadata_osData() throws Throwable {
ChromeUserMetricsExtension log = mPlatformServiceBridge.waitForNextMetricsLog();
SystemProfileProto systemProfile = log.getSystemProfile();
Assert.assertEquals("Android", systemProfile.getOs().getName());
Assert.assertTrue("Should have some os.version", systemProfile.getOs().hasVersion());
Assert.assertTrue("Should have some os.build_fingerprint",
systemProfile.getOs().hasBuildFingerprint());
}
} }
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