Bug 1244295 - Add getClientId test for when client ID file already exists. r=me
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 18 Feb 2016 17:46:52 -0800
changeset 321275 b995a277b126f554e86b555408cc636d0f92dade
parent 321274 5058ad56af493c51b0135ac2d7b34df0b829b76d
child 321276 967a62006b5749752a3f85b02efbf7e189a0339f
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1244295
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1244295 - Add getClientId test for when client ID file already exists. r=me Similar to gfritzsche's suggestion in bug 1244295 comment 26. MozReview-Commit-ID: Agqyj47uSZR
mobile/android/tests/background/junit4/src/org/mozilla/gecko/TestGeckoProfile.java
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/TestGeckoProfile.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/TestGeckoProfile.java
@@ -69,16 +69,26 @@ public class TestGeckoProfile {
         assertValidClientId(clientId);
         assertTrue("client ID file exists", clientIdFile.exists());
 
         assertEquals("Returned client ID is the same as the one previously returned", clientId, profile.getClientId());
         assertEquals("clientID file format matches expectations", clientId, readClientIdFromFile(clientIdFile));
     }
 
     @Test
+    public void testGetClientIdFileAlreadyExists() throws Exception {
+        final String validClientId = "905de1c0-0ea6-4a43-95f9-6170035f5a82";
+        assertTrue("Created the parent dirs of the client ID file", clientIdFile.getParentFile().mkdirs());
+        writeClientIdToFile(clientIdFile, validClientId);
+
+        final String clientIdFromProfile = profile.getClientId();
+        assertEquals("Client ID from method matches ID written to disk", validClientId, clientIdFromProfile);
+    }
+
+    @Test
     public void testGetClientIdMigrateFromFHR() throws Exception {
         final File fhrClientIdFile = new File(profileDir, "healthreport/state.json");
         final String fhrClientId = "905de1c0-0ea6-4a43-95f9-6170035f5a82";
 
         assertFalse("client ID file does not exist", clientIdFile.exists());
         assertTrue("Created FHR data directory", new File(profileDir, "healthreport").mkdirs());
         writeClientIdToFile(fhrClientIdFile, fhrClientId);
         assertEquals("Migrated Client ID equals FHR client ID", fhrClientId, profile.getClientId());