Commit Graph

34 Commits (6ec7bb2bf6724304de08a3c91a6c9b24c84c2964)

Author SHA1 Message Date
Mugurell 0442695972 For #26884 - Merge FeatureSettingsHelper with activity rules 2 years ago
Jonathan Almeida 911f350642 Closes #27077: Load first run experiments synchronously.
Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
Co-authored-by: Charlie Humphreys <chumphreys@mozilla.com>
Co-authored-by: jhugman <jhugman@users.noreply.github.com>
2 years ago
mcarare ffcef5ff2e For #26844: Fix ktlint issues and remove them from baseline. 2 years ago
Mugurell edff593ee6 For #26335: Disable tests for the number of inflations.
These fail in Firebase with different values making the test intermittent.
2 years ago
Mugurell 1f562fe927 For #26335: Allow for more inflations in performance tests
The first patch for this enabled the contile feature by default which based on
the automated tests increased the number of inflations done in HomeActivity.
This patch comes to address that by allowing for up to 6 inflations as seen
reported as the actual count in tests.
2 years ago
sunilk9211 db47f4182d For #25985: Remove ability to click the logo to change the wallpaper 2 years ago
MatthewTighe 72959901d8 Fixes #26245: refactor the WallpaperManager as several WallpaperUseCases 2 years ago
sarah541 8791a25522 For #23966 - Migrate MessageCardViewHolder to Compose 2 years ago
Michael Comella f9b16c772f Closes #24304 - simplify StartupExcessiveResourceUseTest error message.
It's easier to modify the explanation of the heuristics in code comments
rather than command line strings so I moved the failure explanations
into code comments, allowing me to simplify the test failure error messages.
2 years ago
Michael Comella 4e6e5428ea For #24304 - update StartupExcessiveResourceUseTest documentation.
We want this test to be self service for the fenix team so the meaning
of the documentation was updated. Additionally, we clarified why each
heuristic exists to make the test more accessible to self service.
2 years ago
Arturo Mejia b7c1f8ef6b Revert "For #23966 - Migrate MessageCardViewHolder to Compose"
This reverts commit aea6124851.
2 years ago
sarah541 aea6124851 For #23966 - Migrate MessageCardViewHolder to Compose 2 years ago
Arturo Mejia 40f3c8fce5 For #25142 increase the EXPECTED_NUMBER_OF_INFLATION to count for the messaging framework message. 2 years ago
Arturo Mejia 29e0e34902 For #25142 increase the EXPECTED_RECYCLER_VIEW_CONSTRAINT_LAYOUT_CHILDREN to count for the messaging framework message. 2 years ago
mcarare 644c4cec5c For #24841: Decrement suppression count. 2 years ago
MatthewTighe c1d2a9fb70 closes #24366: reset strict mode after locale read 2 years ago
Gabriel Luong 634ed4f164 For #24114 - Decrease EXPECTED_SUPPRESSION_COUNT value to fix StartupExcessiveResourceUseTest 2 years ago
MatthewTighe 5674a4066b closes #24289: reset strict mode after WallpaperManager construction 2 years ago
Gabriel Luong 221ce814ef For #24235 - Remove Tip from HomeFragmentStore 2 years ago
Arturo Mejia 393de99196 For #22851 Add logo animation for wallpapers 2 years ago
mcarare 2577e07aff For #22559: Update leak canary version to 2.8.1 2 years ago
Matt Tighe db71d8dfe7 fixes #22889: add bottom spacer to onboarding adapter 2 years ago
Roger Yang 24e4452cb5 Close #22402: Add top placeholder for home 3 years ago
Michael Comella d4b13ce519 For #21183: remove view hierarchy depth check from excessive resource test.
This doesn't seem to be a high value test: increasing the view hierarchy
depth will only result in a performance problem on low end devices
if there is enough content on the new layer to cause the traversal to
take longer. It's more likely to result in a hard-to-workaround false
positive so we can remove it, like component init count.
3 years ago
Michael Comella 09fe569b30 For #21183: remove component init check from excessive resource test.
This check doesn't seem high value because initializing a component
only indicates a performance problem if it's slow, which is not most
components, so it's likely to result in many false positives. To fix
the intermittent, we won't lose much if we remove it.
3 years ago
Michael Comella 951e49fec4 For #21138: change EXPECTED_RUNBLOCKING to range.
Compared with my local runs, CI sees +1 runBlockingIncrement calls so seems to
take other code paths. As such, we search for a range of rather than a single
value. The main downside I can think of is this could make the test trickier to
debug but we can wait and see if that's a problem in practice before taking
action on it.
3 years ago
Michael Comella 0014f94176 For #21138: re-enable excessive resource use test.
This test wasn't running in CI
https://github.com/mozilla-mobile/fenix/issues/20386 so we changed the
CI configuration so that it will. However, the test was then failing so
this is the revision that unignores the test.

I wonder if componentInit count is useful - it seems like it'd cause
more false positives than not - but I figure we can leave it in and see
how it goes.
3 years ago
Mugurell 621c388c12 For #17917 - Finish migrating all synthetics usages 3 years ago
Aaron Train 5ff2c21849
Filter out test target packages in Flank-x86 (#20841)
* Filter out test target packages in Flank-x86
* Ignore verifyRunBlockingAndStrictModeSuppresionCount
3 years ago
Sebastian Kaspari 971b419d77 Run ktlintFormat to adapt to latest formatting rules. 3 years ago
Sebastian Kaspari 8b5aef7def Update Kotlin to 1.5.10 (and Coroutines to 1.5.0). 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
MarcLeclair 24bce64e0b
16373 Count the # of inflations done on startup (#16778)
* For #16373: Added performance Inflater to counter # of inflations

This class is quite straight forward. The only thing that I have to point out is the onCreateView method. It usually
calls its super if you don't override it. The problem with that is that the super.onCreateView actually uses
android.view. as a prefix for the XML element it tries to inflate. So if we have an element that isn't part
of that package, it'll crash. As I said in the code, a good example is ImageButton. Calling android.view.ImageButton
will make the app crash. The method is implemented the same way that PhoneLayoutInflater does (Another example
is the AsyncLayoutInflater)

* For #16373: Added test for PerformanceInflater

This test got quite awkward / complicated fast.  I wanted to test the  to make sure we don't break *any* of our layouts
and to do so, I decided to just retrieve all our XML in our /res/layout folder. However, this gets quite a bit outside of a unit test scope.
The point was to get every layouts and get their LayoutID through the resources using the testContext we have. It gets even weirder, since some
of the XML tags have special implementation in android. One of them is the <fragment> tag. That tag actually is inflated by the OS using the Factory2
that the Activity.java implements. In order to get around the fragment issue, we just return a basic FrameLayout since the system LayoutInflater doesn't deal
won't ever get a <fragment> tag to inflate. Another issue was the <merge> tag. In order to inflate those, you need 1) a root view and 2) attach your view to it.
In order to be able to test those layouts file, I had to create an empty FrameLayout and use it as the root view for testing. Again, I know this is beyond the spirit of a unit test but if we use this inflater, I think it should make sure that no layouts are broken by it.

* For #16373: Overrode getSystemService to return PerformanceInflater

This allows PerformanceInflater to be called in every inflation to keep track of the number of inflations we do.

* For #16373: Added UI test for # of inflations

* For #16373: Lint fix

* For #167373: Changed the LayoutInflater cloneInContext to take this instead of inflater

The inflater parameter is set on the first call from the OS from  the Window object. However, the activity itself sets multiple factories on the inflater
during its creation (usually through AppCompatDelegateImpl.java). This means that, once we initially set the inflater with a null check, we pass an inflater
that has no factory initially. However, since we keep a reference to it, when cloneInContext was called, it cloned the inflater with the original inflater
which didn't have any factories set up. This meant that the app would crash on either browserFragment creation or any thing that required appCompat (such as
ImageView and ImageButton). Now, passing itself with a cloneInContext means we keep all the factories initially set by the activity or the fragment.

* For #16373: Fixed code issues for PR. No behavior change

* For #16373: fixed some code nits
3 years ago
Michael Comella 72ab058551 For #16376: move Startup*Test to perf pkg under code owners.
Instead of listing many different files here, we should just put them in
/perf/ packages and code owner them.
4 years ago