Bug 1261494 - Add logging before each test to help debug intermittent. r=grisha
MozReview-Commit-ID: LBC49xtrgkl
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testUnifiedTelemetryClientId.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testUnifiedTelemetryClientId.java
@@ -82,16 +82,18 @@ public class testUnifiedTelemetryClientI
/**
* Scenario: Java creates client ID:
* * Fennec starts on fresh profile
* * Java code creates the client ID in datareporting/state.json
* * Js accesses client ID from the same file
* * Assert the client IDs are the same
*/
private void testJavaCreatesClientId() throws Exception {
+ Log.d(LOGTAG, "testJavaCreatesClientId: start");
+
fAssertFalse("Client id file does not exist yet", getClientIdFile().exists());
final String clientIdFromJava = getClientIdFromJava();
final String clientIdFromJS = getClientIdFromJS();
fAssertEquals("Client ID from Java equals ID from JS", clientIdFromJava, clientIdFromJS);
final String clientIdFromJavaAgain = getClientIdFromJava();
final String clientIdFromJSCache = getClientIdFromJS();
@@ -105,16 +107,18 @@ public class testUnifiedTelemetryClientI
/**
* Scenario: JS creates client ID
* * Fennec starts on a fresh profile
* * Js creates the client ID in datareporting/state.json
* * Java access the client ID from the same file
* * Assert the client IDs are the same
*/
private void testJsCreatesClientId() throws Exception {
+ Log.d(LOGTAG, "testJsCreatesClientId: start");
+
fAssertFalse("Client id file does not exist yet", getClientIdFile().exists());
final String clientIdFromJS = getClientIdFromJS();
final String clientIdFromJava = getClientIdFromJava();
fAssertEquals("Client ID from JS equals ID from Java", clientIdFromJS, clientIdFromJava);
final String clientIdFromJSCache = getClientIdFromJS();
final String clientIdFromJavaAgain = getClientIdFromJava();
@@ -129,16 +133,18 @@ public class testUnifiedTelemetryClientI
* Scenario: Java migrates client ID from FHR client ID file.
* * FHR file already exists.
* * Fennec starts on fresh profile
* * Java code merges client ID to datareporting/state.json from healthreport/state.json
* * Js accesses client ID from the same file
* * Assert the client IDs are the same
*/
private void testJavaMigratesFromHealthReport() throws Exception {
+ Log.d(LOGTAG, "testJavaMigratesFromHealthReport: start");
+
fAssertFalse("Client id file does not exist yet", getClientIdFile().exists());
fAssertFalse("Health report file does not exist yet", getFHRClientIdFile().exists());
final String expectedClientId = UUID.randomUUID().toString();
createFHRClientIdFile(expectedClientId);
final String clientIdFromJava = getClientIdFromJava();
fAssertEquals("Health report client ID merged by Java", expectedClientId, clientIdFromJava);
@@ -158,16 +164,18 @@ public class testUnifiedTelemetryClientI
* Scenario: JS merges client ID from FHR client ID file.
* * FHR file already exists.
* * Fennec starts on a fresh profile
* * Js merges the client ID to datareporting/state.json from healthreport/state.json
* * Java access the client ID from the same file
* * Assert the client IDs are the same
*/
private void testJsMigratesFromHealthReport() throws Exception {
+ Log.d(LOGTAG, "testJsMigratesFromHealthReport: start");
+
fAssertFalse("Client id file does not exist yet", getClientIdFile().exists());
fAssertFalse("Health report file does not exist yet", getFHRClientIdFile().exists());
final String expectedClientId = UUID.randomUUID().toString();
createFHRClientIdFile(expectedClientId);
final String clientIdFromJS = getClientIdFromJS();
fAssertEquals("Health report client ID merged by JS", expectedClientId, clientIdFromJS);
@@ -176,17 +184,16 @@ public class testUnifiedTelemetryClientI
final String clientIdFromJavaAgain = getClientIdFromJava();
final String clientIdFromJSCache = getClientIdFromJS();
resetJSCache();
final String clientIdFromJSFileAgain = getClientIdFromJS();
fAssertEquals("Same client ID retrieved from Java", expectedClientId, clientIdFromJavaAgain);
fAssertEquals("Same client ID retrieved from JS cache", expectedClientId, clientIdFromJSCache);
fAssertEquals("Same client ID retrieved from JS file", expectedClientId, clientIdFromJSFileAgain);
-
}
private String getClientIdFromJava() throws IOException {
// This assumes implementation details: it assumes the client ID
// file is created when Java attempts to retrieve it if it does not exist.
final String clientId = profile.getClientId();
fAssertNotNull("Returned client ID is not null", clientId);
fAssertTrue("Client ID file exists after getClientId call", getClientIdFile().exists());