Commit Graph
39 Commits
Author SHA1 Message Date
AlexeyBarabash 602385f418 Removed BraveProfileSyncServiceTest.NoIdentityManagerCalls test 2021-03-23 14:55:25 -04:00
Mario Sanchez Prada f5a98026a6 [WIP] Migrate brave_sync_profile_sync_service_unittest.cc away from mocks
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 <mastiz@chromium.org>
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 <mastiz@chromium.org>
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 <treib@chromium.org>
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
2021-03-23 14:55:11 -04:00
bridiver fb3c0f5561 buildtools/checkdeps/checkdeps.py brave --extra-repos=brave runs succesfully 2021-02-06 13:34:00 -07:00
mkarolin afa1f3f863 signin::IdentityManager::Observer API changes.
Chromium changes:

https://source.chromium.org/chromium/chromium/src/+/351a69fb48fbcb6a504d4294e5e569c405420968

commit 351a69fb48fbcb6a504d4294e5e569c405420968
Author: Mihai Sardarescu <msarda@chromium.org>
Date:   Wed Jan 13 08:33:51 2021 +0000

    Remove OnUnconsentedPrimaryAccount()

    The method OnUnconsentedPrimaryAccount() is obsolete now (as all
    observers were converted to use OnPrimaryAccountChanged()) so this
    CL removes it.

    Bug: 1158855

https://source.chromium.org/chromium/chromium/src/+/b0733098c8f91b856fc9630ee37417d17ba7c6c3

commit b0733098c8f91b856fc9630ee37417d17ba7c6c3
Author: Mihai Sardarescu <msarda@chromium.org>
Date:   Thu Jan 14 16:38:16 2021 +0000

    Remove OnPrimaryAccount{Set|Cleared}

    The methods OnPrimaryAccount{Set|Cleared} were replaced by
    OnPrimaryAccountChanged(). This CL removes them.

    Bug: 1158855
2021-02-04 23:52:38 -05:00
AlexeyBarabash 093598b0b0 Move sync v2 migration after ProfileSyncService::Initialize()
fixes brave-browser#13636
2021-02-04 23:52:32 -05:00
mkarolin 8553d0b90b OnCookieJarChanged signature changed.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/e6f8dd260408c85298a2e22a77064e127db6ffd5

commit e6f8dd260408c85298a2e22a77064e127db6ffd5
Author: Victor Hugo Vianna Silva <victorvianna@google.com>
Date:   Wed Dec 16 08:53:49 2020 +0000

    [sync] Stop recording obsolete cookie jar histograms

    Sync.{CookieJarEmptyOnMismatch,CookieJarMatchOnNavigation} have been
    expired since M77. This CL marks them as obsolete and removes the
    associated plumbing to record them, which is considerable.

    Bug: 1158449
2021-02-04 23:52:29 -05:00
mkarolin 4a9ae715c6 Test files from sync/engine moved to sync/test.
Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/f0dd6a2beeb7f052ccc1aa3c3cc1bf74f3219987

commit f0dd6a2beeb7f052ccc1aa3c3cc1bf74f3219987
Author: Rushan Suleymanov <rushans@google.com>
Date:   Tue Jan 5 11:58:11 2021 +0000

    [Sync] Move test files from sync/engine to sync/test

    Bug: 948661
2021-02-04 23:52:29 -05:00
AlexeyBarabash 0ecbca1071 Addressed review feedback; fixed CI issues 2021-01-10 15:35:21 +02:00
AlexeyBarabash 1ce8a60aca Reorganizing some sync tests
- renamed target to "unit_tests"
     - fixed gn_check errors
     - moved brave_sync_auth_manager_unittest.cc from test/BUILD.gn into proper target
     - had to apply lint to whole test/BUILD.gn
2021-01-10 15:35:15 +02:00
AlexeyBarabash 3c204f886e Testcase for stubbed BraveIdentityManager::GetAccountsInCookieJar 2021-01-10 14:13:05 +02:00
mkarolin 596c1a29ee base/bind_helpers.h -> callback_helpers.h.
Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/52c253e300831067aa75506906a4af2064edadb2

commit 52c253e300831067aa75506906a4af2064edadb2
Author: danakj <danakj@chromium.org>
Date:   Wed Nov 11 21:56:28 2020 +0000

    Reland "Remove empty base/bind_helpers.h"

    This is a reland of 6f8b5118468b9a64fccf59d7918b88f4c7c5342b

    Original change's description:
    > Remove empty base/bind_helpers.h
    >
    > The contents moved to callback_helpers.h.
    >
    > Also renames a few new bind_helpers.h includes that have been added
    > in the meantime.
    >
2021-01-05 21:27:43 -05:00
AlexeyBarabash 6c071fe729 Revert "Merge pull request #7346 from brave/sync_no_identity_manager"
This reverts commit 1df4f6851a, reversing
changes made to ecb32e7549.
2020-12-17 17:08:02 +02:00
AlexeyBarabash 79468a8638 Addressed review feedback; fixed CI issues 2020-12-17 00:53:07 +02:00
AlexeyBarabash 2ff7d8a15f Reorganizing some sync tests
- renamed target to "unit_tests"
     - fixed gn_check errors
     - moved brave_sync_auth_manager_unittest.cc from test/BUILD.gn into proper target
     - had to apply lint to whole test/BUILD.gn
2020-12-16 00:25:26 +02:00
AlexeyBarabash 6cfcea3414 Testcase for stubbed BraveIdentityManager::GetAccountsInCookieJar 2020-12-16 00:25:26 +02:00
AlexeyBarabash d0389465f0 Unit test for trimming whitespaces from sync code words 2020-12-03 23:45:31 +02:00
AlexeyBarabash 6ee60c6478 Trim whitespaces from sync codephrase; fixes brave-browser#10860 2020-12-03 23:45:31 +02:00
bridiver 7224cd640c make BraveProfileSyncServiceDelegate compatible with ios 2020-11-30 07:34:51 -05:00
AlexeyBarabash d40a94336e Fixes includes violation from components to browser; fixes brave-browser#12614 2020-11-10 19:56:33 +02:00
AlexeyBarabash a3273cd075 Fixing deps violation causing linker error on Android x86 2020-11-02 22:01:30 +02:00
AlexeyBarabash bd20dd16ce Getting rid of chrome/browser dependancy from components 2020-10-29 10:35:46 +02:00
AlexeyBarabash b0542f7058 Fixed issue when removed device re-appeared in devices list 2020-10-29 10:30:16 +02:00
AlexeyBarabash 51f6125c83 Doing reset when received own device deleted record from cloud 2020-10-29 10:30:15 +02:00
Anthony Tseng f1d11e27cd Use helper function brave_sync::ResetSync to break circular dependency
between //components/sync/driver and //components/sync_device_info
2020-09-14 17:38:00 -07:00
Anthony Tseng b83970dc9c Revert "Merge pull request #6580 from brave/android_sync_fix_link"
This reverts commit 05e9df9340, reversing
changes made to 176fdd361e.
2020-09-14 15:33:44 -07:00
AlexeyBarabash a2ed4f4563 Fix linker error for non-component Android build; fixes brave-browser#11594 2020-09-04 15:24:18 +03:00
Anthony Tseng 2b528b08b0 Move Get/Set sync code and reset sync to BraveProfileSyncService on desktop 2020-09-02 13:54:08 -07:00
Anthony Tseng 3bd2d4bdd9 Check return value of PassphraseToBytes32 2020-09-01 14:14:52 -07:00
Anthony Tseng 62ed79acdd Subclass ProfileSyncService 2020-07-24 14:41:08 -07:00
Anthony Tseng 540c285adb Check reset state in GetNetworkTime callback
because reset might happen between RequestAccessToken and ResetKeys
2020-07-16 16:32:29 -07:00
Anthony Tseng 22b1f3426e Display brave client id in sync-internals
Reason we need space separator:
In `components/sync/driver/about_sync_util.cc`,
`client_version` and `username` both are `Stat<std::string>*` setting a string
directly. And then pass data to js through `onAboutInfoUpdated` event
which will be eventually passed to `jstProcess` and get value through
`chrome.sync.about_tab.highlightIfChanged(this, this.children[1].innerText, stat_value)'>`
The whole process is no different between these two but <td> of
`username` will have tremendously long width if we don't put any space
in the string.
2020-06-29 17:18:45 -07:00
Anthony Tseng 3361205828 Subclass unused SyncStoppedReporter 2020-06-18 14:13:30 -07:00
Anthony Tseng 26277afbd2 Add missing deps for //components/sync/driver and
add ios guards to //brave/common
2020-06-12 16:35:08 -07:00
Anthony Tseng df0a12dd91 Generalize BRAVE_SERVICES_KEY defines and brave_service_key declare_args
and add BRAVE_SERVICES_KEY header for sync request

Also remove access token VLOG
2020-06-11 01:35:51 -07:00
Anthony Tseng 247a37c0ac remove sync code logging and remove sync v1 ui test 2020-06-09 12:45:48 -07:00
Anthony Tseng 0a9b7e6f21 DeriveSigningKeysFromSeed now requires info so we can derive keys for different purposes with same seed 2020-06-08 23:12:26 -07:00
Anthony Tseng 4275aef8a3 Review feedback: patch cleanup 2020-06-08 23:12:26 -07:00
Anthony Tseng cdb5b5998b Add BraveSyncAuthManagerTest 2020-06-08 23:12:23 -07:00
Anthony Tseng cfaa0f85b3 Introduce NetworkTimeHelper to fetch network time which is updated by
every sync server response. If network time is unavailable, local time
will be used and network time will get updated no matter the access token is
accpeted by server or not. So we no longer need extra access fetcher
to get timestamp from server.
Brave sync now won't set primary account in IdentityManager which
interferes with `chrome.identity` extension API
2020-06-08 23:12:23 -07:00