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.
In order to target specific variants of Fenix, we're adding schemas that
are specific that app in order to avoid collisions with the other
variants and with other forks of fenix that may have the same schemas.
The current schema for variants:
- Fenix Nightly: `fenix-nightly://`
- Fenix Beta: `fenix-beta://`
- Everything else: `fenix://`
This monitor for hot start was intended to be used by FNPRMS to measure
hot start. However, hot start was deprioritized so it's now essentially
unused.
The a-c side of this work is in https://github.com/mozilla-mobile/android-components/pull/6128
This switches Fenix to use `SyncableLoginsStorage`, which caches a connection internally
on first access, and doesn't expose any lock/unlock APIs at the public boundary.
* For #8565: Create custom SharedPreferenceUpdater for String Preferences
* For #8565: Use custom updater to correctly update DropDownPreference
* For #8565: Set default values for dropDown preferences
* For 8565: add tests for findEntriesValue
* For 8565: clarified findEntryValue
Co-authored-by: Severin Rudie <Baron-Severin@users.noreply.github.com>
Added kapt plugin + dependencies in order to be able to use Room
Added recent apps to share fragment (top 6)
Extracted dimens of share_to_apps.xml in the dimens file
- The "Add to Firefox Home" browser menu item adds a top site to the top site storage.
- Refactors the FenixSnackbar from BaseBrowserFragment into BrowserToolbarController
since there are multiple menu items that need to show a FenixSnackbar.
- Adds metrics for the new browser menu item.
This removes Fretboard. The goal is to reduce cold startup costs associated with loading the experiments on the main thread. We currently have two experiments frameworks in use and should only require one.
Cache the list of installed browsers. Calling `Browsers.all`
the application directly redundantly recalculates the list.
Accessing the list of installed browsers through this cache
will reduce that overhead.
* For #4977 - Support opening Fennec pinned website shortcuts in Fenix
Fennec's pinned website shortcuts are set to open the BrowserApp activity.
So we need a new activity alias to actually catch such Intents. Otherwise they
would open "org.mozilla.firefox/.App" without any way to inform that this is
the result of the user clicking on a pinned shortcut.
For actually checking if the newly received Intent is of a Fennec pinned
shortcut we introduce a new FennecBookmarkShortcutsIntentProcessor which will
prepare the Intent to open the shortcut's URL in a new tab.
* For #4977 - Don't keep IntentReceiverActivity on the back stack
For successive Fennec pinned shortcuts to create a new IntentReceiverActivity
and be processed as normal we need to not keep this as our task root.
* For #4977 - Test the FennecBookmarkShortcutsIntentProcessor
* For #220
- Added advanced header + locale settings item in the settings fragment
* For #220
- Added locale selection page with lib state + handling of locale changes
* For #220
- Removed registering for locale changes in the manifest, allow system
to restart activity in that scenario
* For #220
- Added unit tests for locale settings page
* For #220: fixed an outdated unit test
ga-a
Co-authored-by: Severin Rudie <Baron-Severin@users.noreply.github.com>
* Fixes#7048.
Adds extension function to check if online or not based on capabilities
Modified `buildDeviceList`
Modifies tests
* Fixing lint error for max length
Fixing test in AppRequestInterceptorTest.kt
* Adds suppression for deprecation
Moving away from using anko for ConnectivityManager instance
* Creates ConnectivityManager extension component
* Fixes#7180
Refactors test cases to fix static mocks
* For #5334: added private custom tab processor
* For #5334 - Fixes up IntentReceiverActivity for handling intents
* For 5334: update styling for private custom tabbs
* For 5334: update tests to account for new processors
Note that two are still failing. These appear to be true failures, and will be corrected in a later commit.
* For 5334: fixes bug introduced by changes to IntentReceiverActivity
RCA: intent className and extra were previously set based on which processors matched, not which successfully processed. This patch reintroduces that behavior.
* For 5334: add tests for custom tabs processing
* For #5574 - Part 1: Port TabAction.SaveTabGroup to TabSessionInteractor and SessionControlController. (#6651)
- Introduces the TabSessionInteractor, SessionControlInteractor and SessionControlController classes.
- Removes the TabAction.SaveTabGroup.
* For #5574 - Part 2: Port TabAction.PrivateBrowsingLearnMore to TabSessionInteractor and SessionControlController (#6651)
* For #5574 - Part 3: Port TabAction.ShareTabs to TabSessionInteractor and SessionControlController (#6651)
* For #5574 - Part 4: Remove unused TabAction.Share and TabItemMenu (#6651)
In #2205, the tab overflow button was removed which would have shown the
TabItemMenu when clicked. So, we can remove TabItemMenu since it is not
used and as a result, we can also remove TabAction.Share since there are
no consumers.
* For #5574 - Part 5: Port TabAction.PlayMedia and TabAction.PauseMedia to TabSessionInteractor and SessionControlController (#6651)
* For #5574 - Part 6: Port TabAction.Select to TabSessionInteractor and SessionControlController (#6651)
* For #5574 - Part 7: Port Onboarding.Finish to OnboardingInteractor and SessionControlController (#6651)
* For #5574 - Part 8: Port TabAction.Close and TabAction.CloseAll to TabSessionInteractor and SessionControlController (#6651)
- Removes TabAction
* For #5574 - Part 9: Port CollectionAction.Delete to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 10: Port CollectionAction.ShareTabs to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 11: Port CollectionAction.AddTab and CollectionAction.Rename to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 12: Port CollectionAction.RemoveTab to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 13: Port CollectionAction.OpenTab to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 14: Port CollectionAction.CloseTabs to CollectionInteractor and SessionControlController (#6651)
* For #5574 - Part 15: Introduce a HomeFragmentStore (#6651)
- We will hook up the HomeFragmentStore in later parts.
- Removes List<Tab>.toSessionBundle(context: Context) since it is unused.
* For #5574 - Part 16: Port CollectionAction.Collapse and CollectionAction.Expand to CollectionInteractor and SessionControlController (#6651)
- We assume the store is hooked up to the SessionControlController in this part,
but this work will be done in a later part.
- Removes CollectionAction.
* For #5574 - Part 20: Remove the architecture module. (#6651)
* For #5574 - Part 17: Remove duplicate subscribeToTabCollections in BrowserFragment.kt (#6651)
There is a duplicate call of subscribeToTabCollections() in both HomeFragment and BrowserFragment.
In this patch, we remove the call in BrowserFragment to avoid passing the HomeFragmentStore to
BrowserFragment in order to dispatch the CollectionsChange event.
* For #5574 - Part 18: Delete SessionControlComponent and fix TabCollection and Tab imports (#6651)
* For #5574 - Part 19: Use the new HomeFragmentStore in the HomeFragment (#6651)
- Renames SessionControlUIView to SessionControlView
* For #5574 - Part 21: Fix white screen on home fragment (#6651)
* For #5574 - Part 22: Fix formatting in SessionControlInteractor and replace See with @see in SessionControlController (#6651)
* For #5574 - Part 23: Move to metrics.track call to the beginning of handleCollectionRemoveTab (#6651)
This ensures that the metrics.track will be called immediately before the tab is removed from the collection.
* For #5574 - Part 24: Use the sessionManager getter in SessionControlController (#6651)
* For #5574 - Part 25: Use mapNotNull in List<Tab>.toSessionBundle (#6651)
* For #5574 - Part 26: Simplify closeTab and closeAllTabs functions by assigning a deletionJob constant (#6651)
* For #5574 - Part 27: Replace listOf() with emptyList() in removeAllTabsWithUndo (#6651)
* For #5574 - Part 28: Replace the Context parameter with the HomeActivity in SessionControlController (#6651)
* For #5574 - Part 29: Add test for HomeFragmentStore, DefaultSessionControlController and SessionControlInteractor (#6651)
* For #5574 - Removes running CI against the architecture debug build varient
* For #4844: add test cases for url elision
* For 4844: implement toShortUrl to pass test cases
* For 4844: update plumbing to use toShortUrl
* For 4844: adds/handles suggested url elision test case
* For #4281: small ToolbarMenu refactor
This makes it easier to see how items are ordered in the menuItems list
* For 4281: add QAB buttons to menu
* For 4281: removed menu back button per mocks
I double checked with UX, and we'll be relying on the hardware back button for its functionality
* For 4281: add content descriptions for bookmarking
* For 4281: updated BrowserToolbarController for new functionality
* For 4281: provided simple dependencies to browser controller
More complex changes will be in a following commit, for review readability
* For 4281: move toolbar controller dependencies up to BaseBrowserFragment
The functionality they control is being moved into the toolbar menu, which is shared by both normal tabs and custom ones
* For 4281: removed (now unused) code related to QAB
* For 4281: fix test compilation after QAB removal
Tests still need to be expanded to include added functionality
* For 4281: updated menu to show if url is bookmarked
This sloppy workaround is required because TwoStateButton requires that `isInPrimaryState` be a synchronous call, and checking whether or not the current site is bookmarked is quite slow (10-50 MS, in my tests). After days of work and many attempted solutions, this was the least abhorrent among them.
https://github.com/mozilla-mobile/android-components/issues/4915 was opened against AC to evaluate potentially supporting async `isInPrimaryState` functions.
https://github.com/mozilla-mobile/fenix/issues/6370 was opened against Fenix to investigate the unexpectedly slow call to `BookmarkStorage`.
* For 4281: update reader mode switch
* For 4281: selectively show/hide menu items
* For 4281: add reader mode appearance
* For 4281: update bookmark button when it is clicked
* For 4281: removed unused QAB code
* For 4281: removed QAB robot, updated UI tests
* For 4281: removed QuickActionSheet metrics
Since this behavior now lives in the toolbar, it is tracked via Event.BrowserMenuItemTapped
* For 4281: fixed lint errors
* For 4281: add new strings for buttons added to menu
This is necessary because the location change (from QAB to toolbar menu) could affect the grammar in some languages
* For 4281: remove outdated TODOs
* For 4281: removed QAB container
* For 4281: removed back button reference from UI test
This button no longer exists
* For 4821: Fixes a visual defect (extra padding on top of toolbar)
* For 4281: update copy on reader mode
* For 4281: fixed review nits
* Moved some values as member variables as having them declared separately in methods seemed redundant.
* Added @Before method in logtest to avoid code duplication Fixes#4556
* Added @Before method to FragmentTest class Fixes#4556
* variable renamed and added private access specifier; removed set from member variable as it is used only once and we can convert the list to set when needed
* Fixes linter errors
Used runBlocking to ensure we wait for the code using coroutines to execute
instead of runBlockingTest and join() since this last option led to failed
tests in CI because of
"java.lang.IllegalStateException: This job has not completed yet".
* For #4596: move code from CollectionCreationComponent to CollectionCreationStore
Other than adding comments, no changes were made. The code will be updated in a following commit. This is in order to make the commit diff more readable.
* For 4596: update CollectionCreateStore to libstate
* For 4596: copied CollectionCreationUIView into CollectionCreationView
Otherwise, no code was changed. The next commit will update this code. This is in order to make the commit diff more readable.
* For 4596: update CollectionCreationView to LibState
Note that the minimal changes possible to enable migration were made. Refactoring will happen in a later commit.
* For 4596: updated CollectionCreationTabListAdapter to work with the new View
* For 4596: updated SaveCollectionListAdapter to work with the new View
* For 4596: implemented CollectionCreationController
For now, it has an identical interface to the interactor. In a later commit several of its responsibilities will be moved around, some to the interactor and some to the reducer
* For 4596: copied over previous reducer code
No other changes were made. The code will be updated in the following commit. This is done to make changes more readable for the reviewer
* For 4596: update reducer code param names
Otherwise, no changes at this time
* For 4596: add arguments to CreateCollectionFragment in nav_graph
These will be used to replace the current CreateCollectionViewModel, which shares data between fragments in a way that doesn't fit within our architecture.
* For 4596: pass arguments to collection via transaction instead of VM
The VM will be removed in a later commit
* For 4596: update BrowserToolbarController to share state to collection via its Direction
* For 4596: removed CreateCollectionViewModel
* For 4596: test tab retrieval in CreateCollectionFragment
* For 4596: fix crashing CreateCollectionFragmentTest
* For 4596: removed classes create collection classes used by old architecture
* For 4596: collection interactor rename + kdoc
* For 4596: moved collection interactor interface
* For 4596: renamed CreateCollectionFragment
All related classes followed the pattern of CollectionCreationX
* For 4596: kdoc CollectionCreationController
There's no effective difference between these calls and their interactor equivalent, so I linked to them
* For 4596: fix bug that caused rename to not work
* For 4596: removed unused collection actions
These were unused before the LibState refactor
* For 4596: kdoc StepChanged
* For 4596: removed todos about moving logic to the reducer
saveTabsToCollection: this could be moved, but that would involve creating a new action. SaveCollectionStep should probably be refactored out, so adding this layer of indirection seemed counterproductive
handleBackPress: needs to be able to call dismiss(). The reducer doesn't (and shouldn't) be able to do that, so this needs to live here
stepBack: called by handleBackPress. See above
* For 4596: wrote tests for CollectionCreationController#stepback
* For 4596: fixed tests broken by changes to collections
* For 4596: small readability refactor for CollectionController#stepBack
No change to functionality (see tests)
* For 4596: broke apart CollectionView#update
There's probably a lot more that could be done here, but smaller changes were made to reduce scope
* For 4596: remove unnecessary todos
It looks like we don't follow the suggested pattern in this project
* For 4596: test CollectionCreationController#normalSessionSize
* For 4596: updated naming in CollectionCreationController per review
6102: For #6018 Re-add Search Shortcuts Button r=boek a=BranescuMihai
6106: For #5872 & #6075: Set TabHeader buttons to invisible instead of gone. r=boek a=mcarare
At least one button has to be invisible instead of gone to keep layout height.
Tabs overflow button kept gone to avoid empty space on view end in private mode.
Co-authored-by: Mihai Branescu <branescu.mihai2@gmail.com>
Co-authored-by: mcarare <mihai.carare.dev@gmail.com>
5908: Closes#5876: Removed @ObsoleteCoroutinesApi in tests r=sblatz a=shldhll
### Pull Request checklist
<!-- Before submitting the PR, please address each item -->
- [x] **Quality**: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
- [ ] **Tests**: This PR includes thorough tests or an explanation of why it does not
- [ ] **Screenshots**: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
- [ ] **Accessibility**: The code in this PR follows [accessibility best practices](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) or does not include any user facing features
### After merge
- [ ] **Milestone**: Make sure issues finished by this pull request are added to the [milestone](https://github.com/mozilla-mobile/fenix/milestones) of the version currently in development.
### To download an APK when reviewing a PR:
1. click on Show All Checks,
2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
3. click on the "Fenix - assemble" task, then click "Run Artifacts".
4. the APK links should be on the left side of the screen, named for each CPU architecture
Co-authored-by: shldhll <iam.shldhll@gmail.com>
5633: Add fxa/sync integration tests r=csadilek a=isabelrios
Pull Request checklist
<!-- Before submitting the PR, please address each item -->
- [x] **Quality**: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
- [x] **Tests**: This PR includes thorough tests or an explanation of why it does not
- [-] **Screenshots**: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
- [-] **Accessibility**: The code in this PR follows [accessibility best practices](https://github.com/mozilla-mobile/shared-docs/blob/master/android/accessibility_guide.md) or does not include any user facing features
This PR tries to add new tests, sync integration tests, to check the sync process Desktop<->Fenix, first for Bookmarks and in the future for more.
Co-authored-by: Isabel Rios <isabelrios@mackbookirios.home>
Co-authored-by: isabelrios <isabelrios@gmail.com>
* Do not launch in Private Mode
When the app launches do not launch in Private Mode in order to prevent usage leaks to other users of the device.
* Issue #4780: add comments to use private mode
* For #4780: write tests for clear private mode on create app
* For #4780: clear private mode when privacy notification is removed
* For #2754 Add tab cards to share sheet
* For #2754: Fix background near rounded corners and ShareButtonAppearanceTest
* Add license to share_tab_item
* Upgrade to Mozilla Android components 15.0.0-SNAPSHOT
* Update findinpage integration to use browser-state
* Use new UseCases APIs after download migration.
* For #5092 - Show a Snackbar with retry option if sharing to devices fails
ShareController will contain all the business logic for checking the result
status of the `share to device` operations. When this fails it will show a
snackbar which also offer the possibility to retry the just failed operation.
To allow this even in the event the user has closed the share fragment we'll
use a GlobalScope's coroutine.
Refactored out the TabsSharedCallback from ShareFragment because otherwise we
would have neede to sent through that the just failed operation. After the
refactor the ShareController is solely responsable for showing the right
snackbar and handling the retry actions.
* For #5092 - Refactor ShareControllerTest
* For #5092: Adds color theming of snackbars
This introduces test coverage, using the Glean SDK
testing API, for the metrics that are set at startup
by Fenix in the GleanMetricsService.
This additional adds a basic test for the translation
of the `app_opened` event.