Commit 242ca2e1 authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

Remove use of generic SyncableService::GetAllSyncData in unit test

This is a preparation for the removal of said method. Although these
unit tests seem to use an arbitrary SyncableService at first glance,
inspecting SyncValueStoreCache shows the object is actually always one
specific implementation of the interface (SyncStorageBackend). This CL
downcasts the return value of SyncValueStoreCache::GetSyncableService
so that the tests don't depend on the SyncableService interface having
the method.

Bug: 1057577
Change-Id: I8b6e674d28d4b28829b519caf1d930c89552f5c7
Fixed: 1057577
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084991Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/master@{#747163}
parent 4e9fd31c
......@@ -15,6 +15,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/api/storage/sync_storage_backend.h"
#include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
#include "chrome/test/base/testing_profile.h"
......@@ -224,8 +225,14 @@ class ExtensionSettingsSyncTest : public testing::Test {
}
// Gets the syncer::SyncableService for the given sync type.
syncer::SyncableService* GetSyncableService(syncer::ModelType model_type) {
return sync_cache_->GetSyncableService(model_type);
SyncStorageBackend* GetSyncableService(syncer::ModelType model_type) {
// SyncValueStoreCache::GetSyncableService internally enforces |model_type|
// to be APP_SETTINGS or EXTENSION_SETTINGS, and the dynamic type of the
// returned service is always SyncStorageBackend, so it can be downcast.
DCHECK(model_type == syncer::APP_SETTINGS ||
model_type == syncer::EXTENSION_SETTINGS);
return static_cast<SyncStorageBackend*>(
sync_cache_->GetSyncableService(model_type));
}
// Gets all the sync data from the SyncableService for a sync type as a map
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment