• Mikel Astiz's avatar
    Fix UserEventSyncBridge not calling processor's DisableSync · 3266122e
    Mikel Astiz authored
    The call is implemented in the base class's implementation,
    ModelTypeSyncBridge::DisableSync(). Without such a call, the
    processor never takes care of deleting the metadata.
    
    Because UserEventSyncBridge is a commit-only type (in fact the
    only one), it forces initial_sync_done when loading metadata. This
    is now moved to the processor, because it's common for all
    commit-only types and it also needs to be taken care of if
    DisableSync() is followed by enable-sync.
    
    In order to test this, some refactoring of tests was needed (and I
    chose to introduce MockModelTypeChangeProcessor), because:
    a) The former tests had bugs (didn't actually verify some values,
       because callbacks not being run was treated as success)
    
    b) The DisableSync() flow (currently) destroys and recreates the
       change processor, which requires some forwarding proxy to allow
       tests to verify the state across destructions of the processor.
    
    Bug: 819233
    Change-Id: I0f1524850ef65b795b7f7082ce4e85171b8e2898
    Reviewed-on: https://chromium-review.googlesource.com/951604
    Commit-Queue: Mikel Astiz <mastiz@chromium.org>
    Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#541805}
    3266122e
user_event_sync_bridge.cc 10.8 KB