Bug 1409860 - Move os to correct place in android sync ping r=Grisha

MozReview-Commit-ID: DBn8MMVgKPM

--HG--
extra : rebase_source : b51fbfd06f784f2b2c967e33079ed29a05de0710
This commit is contained in:
Thom Chiovoloni 2017-10-19 13:35:16 -04:00
Родитель 3f1b2cd57a
Коммит 57c9bd99fb
2 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -98,8 +98,8 @@ public class TelemetrySyncPingBundleBuilder extends TelemetryPingBuilder {
os.put("locale", Locales.getLanguageTag(Locale.getDefault()));
payload.put("application", application);
payload.put("os", os);
pingData.put("os", os);
pingData.put("version", PING_SYNC_DATA_FORMAT_VERSION);
payload.put("payload", pingData);

Просмотреть файл

@ -126,8 +126,18 @@ public class TelemetrySyncPingBundleBuilderTest {
assertTrue(application.containsKey("buildId"));
assertTrue(application.containsKey("xpcomAbi"));
// Test general shape of payload. Expecting {"syncs":[],"why":"schedule", "version": 1,
// "os": {"name": "Android", "version": "<version>", "locale": "<locale>"}}.
// NB that even though we set an empty sync event store, it's not in the json string.
// That's because sync events are not yet instrumented.
ExtendedJSONObject payload = outgoingPing.getPayload().getObject("payload");
assertEquals(4, payload.keySet().size());
assertEquals("schedule", payload.getString("why"));
assertEquals(Integer.valueOf(1), payload.getIntegerSafely("version"));
assertEquals(0, payload.getArray("syncs").size());
// Test os key.
ExtendedJSONObject os = outgoingPing.getPayload().getObject("os");
ExtendedJSONObject os = payload.getObject("os");
assertEquals(3, os.keySet().size());
assertEquals("Android", os.getString("name"));
// Going to be different depending on the test environment.
@ -135,15 +145,6 @@ public class TelemetrySyncPingBundleBuilderTest {
assertTrue(os.getIntegerSafely("version") != null);
// Likely "en-US" in tests, but let's test for presence and type to avoid random failures.
assertTrue(os.getString("locale") != null);
// Test general shape of payload. Expecting {"syncs":[],"why":"schedule", "version": 1}.
// NB that even though we set an empty sync event store, it's not in the json string.
// That's because sync events are not yet instrumented.
ExtendedJSONObject payload = outgoingPing.getPayload().getObject("payload");
assertEquals(3, payload.keySet().size());
assertEquals("schedule", payload.getString("why"));
assertEquals(Integer.valueOf(1), payload.getIntegerSafely("version"));
assertEquals(0, payload.getArray("syncs").size());
}
@Test