Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Migrate brave_sync_profile_sync_service_unittest.cc away from m…
…ocks SyncApiComponentFactoryMock is no longer available upstream, and FakeSyncApiComponentFactory should be used instead, along with some other smaller changes derived from other recent related changes upstream. This patch adapts the unit tests to maintain the same behaviour while using the new fake-based APIs, instead of the old ones. [TODO] BraveProfileSyncServiceTest.NoIdentityManagerCalls is not completely migrated yet, we still need to migrate mock-based check EXPECT_CALL(*engine(), OnCookieJarChanged(_, _)).Times(0) Chromium changes: https://chromium.googlesource.com/chromium/src.git/+/dcdd123f162664500d3976cdcb8e575ad8711bcf https://chromium.googlesource.com/chromium/src.git/+/0ff6cfd2ae2f17dd8f99ae09f04b0fb24fd2a09f https://chromium.googlesource.com/chromium/src.git/+/e60c93afaa485a6641ccd26222581626f74a7cac commit dcdd123f162664500d3976cdcb8e575ad8711bcf Author: Mikel Astiz <[email protected]> Date: Fri Jan 29 18:43:53 2021 +0000 [sync] Move SyncTransportDataPrefs closer to SyncEngineImpl These preferences represent the internal bookkeeping data that the implementation of the sync engine owns (SyncEngineImpl, backend, etc.), to be persisted in prefs. This patch moves the resposibility for dealing with prefs (reads and writes) from ProfileSyncService to SyncEngineImpl, simplifying some of of the APIs in between and adhering to more strict layering principles. Instead of moving all functionality in a single patch, the most relevant parts are moved, but TODOs are added to move the remaining parts and therefore completely avoid the dependency from ProfileSyncService to SyncTransportDataPrefs. Meanwhile, *both* ProfileSyncService and SyncEngineImpl interact with these preferences, which is obviously not great. Bug: 938894 commit 0ff6cfd2ae2f17dd8f99ae09f04b0fb24fd2a09f Author: Mikel Astiz <[email protected]> Date: Fri Jan 29 12:52:21 2021 +0000 [sync] Avoid abuse of mocks in ProfileSyncService tests In particular the tests in ProfileSyncServiceStartupTest made heavy use of statefull mocks, well beyond a reasonable use of mocks. Instead, this patch adopts fakes that mimic the production behavior without tests having to carefully do so. For DataTypeManager, there is currently no fake, so instead the actual DataTypeManagerImpl is used, which is perfectly testable in combination with FakeDataTypeController. Bug: 938894 commit e60c93afaa485a6641ccd26222581626f74a7cac Author: Marc Treib <[email protected]> Date: Tue Jan 26 17:10:16 2021 +0000 Cleanup: Remove initial_types param from DataTypeManagerImpl's ctor The param was used to initialize the downloaded_types_ member, but that anyway got recomputed in ActivateDataTypes(), so the initial value had no effect. This CL removes the param, and all the plumbing that was in place for it. Note that there was one test which used the initial_types param, with the intention of marking these types as "already downloaded". The test passes before as after this CL. Fixing the test so that it actually tests what it claims to test is left as a followup. Bug: 1170318
- Loading branch information