Bug 1261494 - Add logging before each test to help debug intermittent. r=grisha draft
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 03 Jun 2016 14:56:51 -0700
changeset 375318 c5ed93eccba83d9005df3a21743e5d5eae00a8e3
parent 375317 5925ba9bbe18d246c89b84ad3f5e6a6436905112
child 522823 5c04a756d225ab1bbaffa683ea636603b3211ee9
push id20227
push usermichael.l.comella@gmail.com
push dateFri, 03 Jun 2016 21:58:13 +0000
reviewersgrisha
bugs1261494
milestone49.0a1
Bug 1261494 - Add logging before each test to help debug intermittent. r=grisha MozReview-Commit-ID: LBC49xtrgkl
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testUnifiedTelemetryClientId.java
--- 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());