Bug 1479026 - Adjust GeckoView telemetry API tests to match corrected schema. r=janerik, r=jchen, a=lizzard
☠☠ backed out by 2d3a55472637 ☠ ☠
authorEugen Sawin <esawin@mozilla.com>
Tue, 31 Jul 2018 13:19:00 +0300
changeset 480828 d3a8b368ded7b6da0eb597c18d41bef86c23ee1a
parent 480827 2f58ed9bd8c13cb99937dd951c80990e2d6d0e01
child 480829 2d3a55472637ec5252d9be828991709f07ac4664
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanerik, jchen, lizzard
bugs1479026
milestone62.0
Bug 1479026 - Adjust GeckoView telemetry API tests to match corrected schema. r=janerik, r=jchen, a=lizzard
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt
@@ -14,16 +14,17 @@ import org.mozilla.geckoview.test.rule.G
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ReuseSession
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.Setting
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.WithDevToolsAPI
 import org.mozilla.geckoview.test.util.Callbacks
 
 import android.support.test.filters.MediumTest
 import android.support.test.runner.AndroidJUnit4
 import org.hamcrest.Matchers.*
+import org.junit.Assume.assumeThat
 import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
 
 @RunWith(AndroidJUnit4::class)
 @MediumTest
 @ReuseSession(false)
 class NavigationDelegateTest : BaseSessionTest() {
@@ -91,31 +92,46 @@ class NavigationDelegateTest : BaseSessi
         sessionRule.session.reload()
         sessionRule.session.waitForPageStop()
 
         assertThat("User agent should be set to mobile",
                    sessionRule.session.evaluateJS(userAgentJs) as String,
                    containsString(mobileSubStr))
     }
 
-    @Test fun telemetry() {
+    fun telemetryTest(process: String) {
         sessionRule.session.loadTestPath(HELLO_HTML_PATH)
         sessionRule.waitForPageStop()
 
         val telemetry = sessionRule.runtime.telemetry
         val result = sessionRule.waitForResult(telemetry.getSnapshots(true))
 
+        val snapshots = result?.get(process) as GeckoBundle
+
+        assertThat("Snapshots should not be null",
+                   snapshots, notNullValue())
+
         assertThat("Histograms should not be null",
-                   result?.get("histograms"), notNullValue())
+                   snapshots.get("histograms"), notNullValue())
         assertThat("Keyed histograms should not be null",
-                   result?.get("keyedHistograms"), notNullValue())
+                   snapshots.get("keyedHistograms"), notNullValue())
         assertThat("Scalars should not be null",
-                   result?.get("scalars"), notNullValue())
+                   snapshots.get("scalars"), notNullValue())
         assertThat("Keyed scalars should not be null",
-                   result?.get("keyedScalars"), notNullValue())
+                   snapshots.get("keyedScalars"), notNullValue())
+    }
+
+    @Test fun telemetryParent() {
+        telemetryTest("parent")
+    }
+
+
+    @Test fun telemetryContent() {
+        assumeThat(sessionRule.env.isMultiprocess, equalTo(true));
+        telemetryTest("content")
     }
 
     @Test fun load() {
         sessionRule.session.loadTestPath(HELLO_HTML_PATH)
         sessionRule.waitForPageStop()
 
         sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
             @AssertCalled(count = 1, order = [1])