Commit Graph

65 Commits (74c1cc82fb4975f63c20a718f09367149bcc3c70)

Author SHA1 Message Date
Roger Yang 74c1cc82fb Closes #19921: Update appcompat and fragment dependencies to 1.3.x 3 years ago
Gabriel Luong 9d3cf79051 For #19916 - Add last viewed tab to home screen
Co-authored-by: Jonathan Almeida <jalmeida@mozilla.com>
3 years ago
Sebastian Kaspari 4753a1d494 Complete browser-state migration and remove browser-session dependency.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
3 years ago
Arturo Mejia c725493bea Fix openFile breaking changes 3 years ago
MarcLeclair 990bfa7e6d
16900 make navgraph inflation asynchronous (#18889)
* For #16900: implement async navgraph inflation

For #16900: removed nav graph from xml

For #16900: inflate navGraph programatically

For #16900: Made NavGraph inflation asynchronous

For #16900: Changed to block with runBlocking

For #16900: Refactored blocking call into a function

For 16900: NavGraph inflation is now async

We now attach the nav graph (or check if its attached) on every nav call ( an extension function for NavController).
This is done by checking the value of the job stored in PerfNavController.map which keeps track of the job with the NavController as a Key.
If the job hasn't been completed, it will block the main thread until the job is done. The job itself is responsible for attaching the navgraph
to the navcontroller (and the inflation of the latter too)

For 16900: rebased upstream master

For 16900: Rebase on master

For #16900: Fixed Async Navgraph navigation per review comments.

1)The Asynchronous method is now found in NavGraphProvider.kt. It creates a job on the IO dispatcher
2)The Job is tracked through a WeakHashMap from Controller --> NavGraph
3)The Coroutine scope doesn't use MainScope() anymore
4)The Coroutine is cancelled if the Activity is destroyed
5)The tests mockk the blockForNavGraphInflation method through the FenixReoboelectricTestApplication instead of calling the mock every setup()

For #16900: inflateNavGraphAsync now takes navController

For #16900: Pass lifecycleScope to NavGraphProvider

For #16900: removed unused mock

For #16900: Added linter rules for navigate calls

We need linting rules to make sure no one calls the NavController.navigate() methods

For #16900: Added TestRule to help abstract the mocks in the code

For 16900: Fix linting problems

For #16900: Cleaned duplicated code in tests

For #16900: cleaned up NavGraphTestRule for finished test

For #16900: had to revert an accidentally edited file

For #16900: rebased master

* For #16900: Review nits for async navgraph

This is composed of squash commits, the original messages can be found below:

-> DisableNavGraphProviderAssertionRule + kdoc.

Use test rule in RobolectricApplication.

Fix failing CrashReporterControllerTest

Fix blame by -> navigate in tests.

This commit was generated by the following commands only:
```
find app/src/test -type f -exec sed -i '' "/import org.mozilla.fenix.ext.navigateBlockingForAsyncNavGraph/d" {} \;
find app/src/test -type f -exec sed -i "" "s/navigateBlockingForAsyncNavGraph/navigate/g" {} \;
git checkout app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
```

Fix various blame

This is expected to be squashed into the first commit so, if so, it'd
fix the blame.

Move test rule to helpers pkg.

add missing license header

Add import change I missed

fix unused imports

Replace robolectricTestrunner with test rule.

Improve navGraphProvider docs

Remove unnecessary rule as defined by robolectric.

add clarifying comment to robolectric

remove unnecessary space

* For #16900: nit fixes for MozillaNavigateCheck and lint fixes

3 squash commits:
 *Changed violation message and fixed the lint rule for MozillaNavigateCheck
 *Added suppression to NavController.kt
 *Fixed detekt violations

* For 16900: Fixed failing tests

Co-authored-by: Michael Comella <michael.l.comella@gmail.com>
3 years ago
Arturo Mejia 0e8dc6164d Target Android 11 3 years ago
Sebastian Kaspari f4f5e4b663 Issue #17174: Remove usage of old media APIs. 3 years ago
Grisha Kruglov ebca575e26 Reuse helper functions in bookmark tests 3 years ago
MarcLeclair 7b1af41b40
15278 detekt rule runblocking (#15942)
* For #15278: added CoroutineManager to count runBlocking calls

* For #15278: Added actual detekt rule for runblocking and its config to the yaml

* For #15278: Added unit test for RunblockingCounter

* For #15278: renamed StrictModeStartupSuppressionCountTest.kt to PerformanceStartupTest.kt and added runBlockingCount test

* Lint fix

* For #15278: made runblocking a Long to prevent overflow

* For #15278: fixed MozRunblocking name, description and moved RunBlockingCounter to perf package

* For #15278:Renamed MozillaRunblockingCheck to MozillaRunBlockingCheck

* For #15278: Added setup for unit test, since it failed without restting counter

* For #15278: Fixed naming for RunBlocking lint check

* For #15278: removed changes made to test to use runBlockingIncrement

* For #15728: added test exclusion for runBlocking check

* For #15278: changed null check and added Synchronized to count setter

* For #15278: fix for nits

* For #15278: added StartupExcessiveResourceUseTest to CODEOWNERS

* For #15278: fixed for nits

* For #15278: Moved increment function to extension function and fixed indentation

* For #15278: Added tests for Atomic Integer extension and nit fix
4 years ago
Michael Comella 42cca072e2 For #13959: remove resetAfter & port tests to StrictModeManager. 4 years ago
Kate Glazko e8855c09e6 For #15320: Ensure Mimetype Other PDF Shows PDF Icon 4 years ago
Tiger Oakes b563576335
Closes #14131: Move constants to dimens.xml (#14135)
Co-authored-by: Elise Richards <erichards@mozilla.com>
4 years ago
ekager 09fbb43f80 For #2486 - Adds Recently Closed Tabs 4 years ago
Kate Glazko ffb794751e No Issue: Fix DownloadItemKtTest 4 years ago
kglazko 5ecab0f48a
For #13935: Enhanced File Type List Icons (#14036)
* For #13935: Enhanced File Type List Icons

* For #13935 - Pulls out and tests logic for getting the icon for a DownloadItem

Co-authored-by: Kate Glazko <kglazko@Kates-MacBook-Pro.local>
Co-authored-by: Jeff Boek <jeff@jeffboek.com>
4 years ago
Kate Glazko 3370762248 For #13983: Show Only Completed Downloads in List 4 years ago
Kate Glazko 7f9e2255f7 For #13979: Deleted Download Files Shouldnt Show 4 years ago
Kainalu Hagiwara d9ffac0c89 For #13405 - Use toolbar location relative to the whole screen instead of window. 4 years ago
Sebastian Kaspari c93a29f89a Simplify build variants to just: debug, nightly, beta and release.
Co-authored-by: Johan Lorenzo <jlorenzo@mozilla.com>
4 years ago
Kainalu Hagiwara 57c7955637 For #12865, #12990 - Disable swipe to switch tabs gesture when the keyboard is visible. 4 years ago
ekager 46511d6f8e For #10163 - Adds tab multiselect mode 4 years ago
Tiger Oakes d3a07e95c9 For #12565: Don't pass contest to SortingStrategy 4 years ago
Tiger Oakes 652af79e95
Migrate from Session.toTab to BrowserStore (#12221) 4 years ago
Tiger Oakes 4dd0c0f224
For #12457: Add MockK matcher for intents (#12612) 4 years ago
Tiger Oakes 69020a1f26
For #12457 - Add MockK matcher for nav directions (#12262) 4 years ago
Tiger Oakes c99a8f5cfa
Fixes #9832 - Change targetSdkVersion to Android 10 (#11014) 4 years ago
Tiger Oakes 41452e945b Move SearchProviderModel extension to class 4 years ago
Tiger Oakes 6bde0378a2
Add tests for StrictModeManager (#12013) 4 years ago
Tiger Oakes ccb532bb77
For #11534 - Don't check lastUsed mode for screenshots (#11827) 4 years ago
Tiger Oakes 18cc4c95c1
Add tests for ContextKt (#11824)
Migrated from an old branch by Kate

Co-authored-by: Kate Glazko <katglazko@gmail.com>
4 years ago
Tiger Oakes f0295048fa Remove Mockito 4 years ago
Tiger Oakes 4b064afb81
Add tests for ext package (#11334) 4 years ago
Christian Sadilek fee09c3092 No issue: Show article/page url instead of reader extension url 4 years ago
Mihai Branescu c4d76dce5a For #6558 - cleanup + added unit tests 4 years ago
mcarare 8cdc523de9 For #9698: Add unit tests for Context extension getStringWithArgSafe 4 years ago
Mihai Eduard Badea d66da53c9a For #2768 - Prevent screenshots in private mode
Added a new option in Private browsing menu to allow or prevent screenshots from being taken while in private mode by adding or removing the FLAG_SECURE flag from the home activity's window.

 This method is called whenever the activity is initialized to account for the browsing mode being changed and whenever the setting from the Private browsing menu is changed.

 The setting is by default set to true (screenshots are allowed to be taken)
4 years ago
Michael Comella 376740cd2c For #9631: replace assertk assertions with junit.
I created a series of editor macros to do this with minimal errors (and
to do it quickly!).
4 years ago
Michael Comella 6e0d851da3 For #9605: replace unit test runners with FenixRobolectricTestRunner.
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
4 years ago
Michael Comella 392dda5eda For #9605: remove unnecessary @RunWith(Robolectric in unit tests.
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.
4 years ago
Tiger Oakes 453e7955bb
Add license header to ext tests (#8130) 4 years ago
Suraj Shah 2d64cf8e4c Connectivity manager tests (#7317)
* Fixes #7316
Adds tests for ConnectivityManager.isOnline

* Fixes detekt errors.

* Cleaning tests

* Cleaning tests to use boolean checks instead of object equals
4 years ago
Severin Rudie b23ee38082 For #7556: fix intermittent failure in BookmarkNodeTest 4 years ago
Michael Comella cf143489e1 For #6464: Replace use of BuildConfig.DEBUG with ReleaseChannel.channel.isDebug.
This fixes performance issues where StrictMode would greatly slow down
startup in the forPerformanceTest variants.
4 years ago
Tiger Oakes ea486d7c66
Split out CustomTabToolbarIntegration (#7107) 5 years ago
Severin Rudie 7477de83e9 For #4844: fix file prefix url shortening 5 years ago
cesar 63cf034bfb test fixed 5 years ago
Daphne Liu 4cfbaf2dc4 Switched to AC string extensions (#6258)
* Switched to AC string extensions

* Clean up imports
5 years ago
Severin Rudie 8d68317388
4844 fix url elision (#6588)
* 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
5 years ago
Shangeeth Sivan 218763f9be For #4556: Removed redundant code in few tests. (#6367)
* 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
5 years ago
Jeffrey Starke 6a6c4f75dd * Move repeated NavControllerTest logic to @Before set up method
* Use property access syntax where applicable in NavControllerTest
5 years ago