author | Margaret Leibovic <margaret.leibovic@gmail.com> |
Sun, 03 Apr 2016 18:27:00 -0400 | |
changeset 291794 | aedf35fb81d98ad4d53253f1abd680023f2848f1 |
parent 291793 | 27bd269e54937b99b0eef25ce849400a29c48fdb |
child 291795 | 71d3427c683190cdb409063ad67e24d5926f4591 |
push id | 74679 |
push user | kwierso@gmail.com |
push date | Tue, 05 Apr 2016 23:39:26 +0000 |
treeherder | mozilla-inbound@b70ae970d45d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sebastian |
bugs | 1261713 |
milestone | 48.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
|
mobile/android/tests/background/junit4/src/com/keepsafe/switchboard/TestSwitchboard.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/tests/background/junit4/src/com/keepsafe/switchboard/TestSwitchboard.java +++ b/mobile/android/tests/background/junit4/src/com/keepsafe/switchboard/TestSwitchboard.java @@ -6,16 +6,17 @@ import org.json.JSONException; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mozilla.gecko.background.testhelpers.TestRunner; import org.robolectric.RuntimeEnvironment; import java.io.IOException; +import java.util.List; import java.util.UUID; import static org.junit.Assert.*; @RunWith(TestRunner.class) public class TestSwitchboard { private static final String TEST_JSON = "{\"active-experiment\":{\"isActive\":true,\"values\":{\"foo\": true}},\"inactive-experiment\":{\"isActive\":false,\"values\":null}}"; @@ -50,9 +51,19 @@ public class TestSwitchboard { assertTrue("active-experiment has values", SwitchBoard.hasExperimentValues(c, "active-experiment")); assertFalse("inactive-experiment doesn't have values", SwitchBoard.hasExperimentValues(c, "inactive-experiment")); final JSONObject values = SwitchBoard.getExperimentValuesFromJson(c, "active-experiment"); assertNotNull("active-experiment values are not null", values); assertTrue("\"foo\" extra value is true", values.getBoolean("foo")); } + @Test + public void testGetActiveExperiments() { + final Context c = RuntimeEnvironment.application; + final List<String> experiments = SwitchBoard.getActiveExperiments(c); + assertNotNull("List of active experiments is not null", experiments); + + assertTrue("List of active experiments contains active-experiemnt", experiments.contains("active-experiment")); + assertFalse("List of active experiments does not contain inactive-experiemnt", experiments.contains("inactive-experiment")); + } + }