Commit 66530d6d authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Cleanup syncer::FakeSyncService

This removes a bunch of methods/members that aren't used (anymore).

Bug: 859874
Change-Id: Ia3d0c3be3b1bfdaa9230a26e0ad44c9ea359bf43
Reviewed-on: https://chromium-review.googlesource.com/c/1326004Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606442}
parent 8439625b
...@@ -6,41 +6,25 @@ ...@@ -6,41 +6,25 @@
#include "base/values.h" #include "base/values.h"
#include "components/signin/core/browser/account_info.h" #include "components/signin/core/browser/account_info.h"
#include "components/sync/driver/data_type_controller.h"
#include "components/sync/driver/sync_token_status.h" #include "components/sync/driver/sync_token_status.h"
#include "components/sync/syncable/base_transaction.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
#include "components/sync/syncable/user_share.h" #include "components/sync/syncable/user_share.h"
#include "google_apis/gaia/google_service_auth_error.h"
namespace syncer { namespace syncer {
// Dummy methods // Dummy methods
FakeSyncService::FakeSyncService() FakeSyncService::FakeSyncService()
: error_(GoogleServiceAuthError::NONE), : user_share_(std::make_unique<UserShare>()) {}
user_share_(std::make_unique<UserShare>()) {}
FakeSyncService::~FakeSyncService() {} FakeSyncService::~FakeSyncService() = default;
int FakeSyncService::GetDisableReasons() const { int FakeSyncService::GetDisableReasons() const {
// Note: Most subclasses will want to override this. return DISABLE_REASON_NOT_SIGNED_IN;
return DISABLE_REASON_PLATFORM_OVERRIDE;
} }
syncer::SyncService::TransportState FakeSyncService::GetTransportState() const { syncer::SyncService::TransportState FakeSyncService::GetTransportState() const {
// This is a temporary partial copy of the real implementation in return TransportState::DISABLED;
// ProfileSyncService, containing only the things that exist in the
// FakeSyncService. If subclasses override some of the individual getters,
// this should still return a reasonable result.
if (GetDisableReasons() != DISABLE_REASON_NONE) {
return TransportState::DISABLED;
}
// From this point on, Sync can start in principle.
DCHECK(CanSyncFeatureStart());
if (!IsFirstSetupComplete()) {
return TransportState::PENDING_DESIRED_CONFIGURATION;
}
return TransportState::ACTIVE;
} }
AccountInfo FakeSyncService::GetAuthenticatedAccountInfo() const { AccountInfo FakeSyncService::GetAuthenticatedAccountInfo() const {
...@@ -158,7 +142,7 @@ SyncCycleSnapshot FakeSyncService::GetLastCycleSnapshot() const { ...@@ -158,7 +142,7 @@ SyncCycleSnapshot FakeSyncService::GetLastCycleSnapshot() const {
} }
std::unique_ptr<base::Value> FakeSyncService::GetTypeStatusMap() { std::unique_ptr<base::Value> FakeSyncService::GetTypeStatusMap() {
return std::make_unique<base::ListValue>(); return nullptr;
} }
const GURL& FakeSyncService::sync_service_url() const { const GURL& FakeSyncService::sync_service_url() const {
...@@ -166,7 +150,7 @@ const GURL& FakeSyncService::sync_service_url() const { ...@@ -166,7 +150,7 @@ const GURL& FakeSyncService::sync_service_url() const {
} }
std::string FakeSyncService::unrecoverable_error_message() const { std::string FakeSyncService::unrecoverable_error_message() const {
return unrecoverable_error_message_; return std::string();
} }
base::Location FakeSyncService::unrecoverable_error_location() const { base::Location FakeSyncService::unrecoverable_error_location() const {
......
...@@ -7,19 +7,16 @@ ...@@ -7,19 +7,16 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility>
#include "components/signin/core/browser/account_info.h"
#include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
#include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/google_service_auth_error.h"
#include "url/gurl.h"
namespace syncer { namespace syncer {
class BaseTransaction; // Minimal fake implementation of SyncService. All methods return inactive/
struct UserShare; // empty/null etc. Tests can subclass this to override the parts they need, but
// should consider using TestSyncService instead.
// Fake implementation of SyncService, used for testing.
class FakeSyncService : public SyncService { class FakeSyncService : public SyncService {
public: public:
FakeSyncService(); FakeSyncService();
...@@ -87,7 +84,6 @@ class FakeSyncService : public SyncService { ...@@ -87,7 +84,6 @@ class FakeSyncService : public SyncService {
private: private:
GoogleServiceAuthError error_; GoogleServiceAuthError error_;
GURL sync_service_url_; GURL sync_service_url_;
std::string unrecoverable_error_message_;
std::unique_ptr<UserShare> user_share_; std::unique_ptr<UserShare> user_share_;
}; };
......
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