This is how we can apply the new test runner to remove duplication.
This commit was generated programmatically with the following commands:
```
// Replace test runners with new one.
find app/src/test -type f -exec gsed -i "s/@RunWith(RobolectricTestRunner::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
find app/src/test -type f -exec gsed -i "s/@RunWith(AndroidJUnit4::class)/@RunWith(FenixRobolectricTestRunner::class)/" {} +
// Replace imports of old test runners with new one
find app/src/test -type f -exec gsed -i "s/org.robolectric.RobolectricTestRunner/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
find app/src/test -type f -exec gsed -i "s/androidx.test.ext.junit.runners.AndroidJUnit4/org.mozilla.fenix.helpers.FenixRobolectricTestRunner/" {} +
// Remove unused imports
find app/src/test -type f -exec gsed -i "/@Config(application = TestApplication::class)/d" {} +
find app/src/test -type f -exec gsed -i "/import org.mozilla.fenix.TestApplication/d" {} +
find app/src/test -type f -exec gsed -i "/import org.robolectric.annotation.Config/d" {} +
```
Where gsed is the GNU version of sed installed via homebrew. After
running these commands, I need to manually clean up the following files:
- FenixRobolectricTestRunner
- LocaleManagerExtensionTest
robolectric increases the run time of tests so it's important to remove
them when they're unnecessary.
Between this change and the last one, the unit test runtime was reduced
by ~10s.
In unit tests, this annotation annotations defer to robolectric, non-trivially
increasing test runtime so it's important to remove them when they're
unnecessary.
I removed the version constant indirection for these items because I found it
challenging:
- it makes it harder to quickly identify which versions are in use
because it requires jumping to a new screen for each dependency
- it increases the length of the file, obscuring what's available
We could consider renaming the Activity to make it clearer that it's the
main activity and doesn't just feature the homescreen but I'm concerned
that renaming it will break too many things (e.g. automation that starts
a specific activity). For quick fix, I added this comment.
* Add google-search-restaurants to pageload tests in browsertime.
* Temporarily change the activity to pass tests.
* Change Raptor Fenix activity name.
* Remove test trigger for browsertime test.
fix: flank_snapshot requires direct shard value
-1 shards -> 50 shards
fix: adjust flank-x86.yml shard value
try old results generator in flank-x86.yml
fix: legacy-junit-report -> legacy-junit-result
revert to modern reporting
AccountObserver listeners were being triggered correctly, however, during every time
we open HomeFragment, home menu gets re-created, which causes us to re-run the initialization
block. Before this patch, the init block would never touch the account manager.
After this patch, it will query it if account manager has already been initialized.
`init` blocks are executed before `val` initialization which is declared afterwards
in the class. In this case, we had `quitItem` and `reconnectToSyncItem` as lazy,
but declared after the `init` block which may need them. And so, while this compiles
just fine, in practice we run into an NPE as the `init` block tries to get the lazy's value.
Simply re-ordering initialization fixes the problem.