Have AppSearchProviderTest sort deterministically
Before this commit, the tests were brittle, relying on the order (prior to sorting) that apps were presented. Also update the FetchRecommendationsWithContinueReading test code to only call base::Time::Now() once. Now's base/time/time.h comment says: "Watch out, the system might adjust its clock in which case time will actually go backwards. We don't guarantee that times are increasing". The base::Time::Now change isn't necessary to fix the test, but it makes for a more robust test. This fixes `unit_tests --enable-features=AppServiceAsh --gtest_filter="AppSearchProviderTest.FetchRecommendationsWithCont*"`. It fails before and passes after this commit. Note that `unit_tests --gtest_filter="AppSearchProviderTest.FetchRecommendationsWithCont*"`, without AppServiceAsh enabled, passes both before and after this commit. BUG=826982 Change-Id: Iaf6defc23052963e88bc9c27e759a356ef24698e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636664 Commit-Queue: Nigel Tao <nigeltao@chromium.org> Reviewed-by:Xiyuan Xia <xiyuan@chromium.org> Cr-Commit-Position: refs/heads/master@{#664992}
Showing
Please register or sign in to comment