Commit 011e523c authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

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: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710655}
parent 3db8561a
......@@ -22,6 +22,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.components.metrics.ChromeUserMetricsExtensionProtos.ChromeUserMetricsExtension;
import org.chromium.components.metrics.MetricsSwitches;
import org.chromium.components.metrics.SystemProfileProtos.SystemProfileProto;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import java.util.concurrent.BlockingQueue;
......@@ -109,4 +110,44 @@ public class AwMetricsMetadataTest {
Assert.assertTrue("Should have some client_id", log.hasClientId());
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());
Assert.assertTrue(
"Should have some is_instrumented_build", systemProfile.hasIsInstrumentedBuild());
}
@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