summaryrefslogtreecommitdiffstats
path: root/sync/engine
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:56:43 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-11 13:56:43 +0000
commit325c350df9c95200a5363a3a4ef9dea4af5d807e (patch)
treec3d45d16a034f61b83b1295c43c021298f564901 /sync/engine
parent3d146b44d0be75328ac1873042141ba76778cfc0 (diff)
downloadchromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.zip
chromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.tar.gz
chromium_src-325c350df9c95200a5363a3a4ef9dea4af5d807e.tar.bz2
Split up SyncEngineEventListener callbacks
Splits up the SyncEngineEventListener calls into one callback per event type. This allow us to trim the 'event' objects so they only contain elements relevant to their event. Also removes some dead code related to STOP_SYNCING_PERMANENTLY, which is no longer in use. It may have been used for birthday errors in the past, but those are now handled with ActionableError. It was used for CLEAR_USER_DATA, but that feature is no longer supported. BUG=339984 Review URL: https://codereview.chromium.org/152013003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r--sync/engine/all_status.cc49
-rw-r--r--sync/engine/all_status.h11
-rw-r--r--sync/engine/sync_cycle_event.cc14
-rw-r--r--sync/engine/sync_cycle_event.h39
-rw-r--r--sync/engine/sync_engine_event.cc14
-rw-r--r--sync/engine/sync_engine_event.h83
-rw-r--r--sync/engine/sync_engine_event_listener.cc13
-rw-r--r--sync/engine/sync_engine_event_listener.h42
-rw-r--r--sync/engine/sync_scheduler_impl.cc45
-rw-r--r--sync/engine/sync_scheduler_impl.h7
-rw-r--r--sync/engine/syncer.cc4
-rw-r--r--sync/engine/syncer_proto_util.cc6
-rw-r--r--sync/engine/syncer_proto_util_unittest.cc2
-rw-r--r--sync/engine/syncer_unittest.cc16
14 files changed, 174 insertions, 171 deletions
diff --git a/sync/engine/all_status.cc b/sync/engine/all_status.cc
index e5f5124..e5840f3 100644
--- a/sync/engine/all_status.cc
+++ b/sync/engine/all_status.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/port.h"
#include "sync/engine/net/server_connection_manager.h"
+#include "sync/engine/sync_cycle_event.h"
#include "sync/internal_api/public/base/model_type.h"
namespace syncer {
@@ -35,7 +36,7 @@ SyncStatus AllStatus::CreateBlankStatus() const {
return status;
}
-SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const {
+SyncStatus AllStatus::CalcSyncing(const SyncCycleEvent &event) const {
SyncStatus status = CreateBlankStatus();
const sessions::SyncSessionSnapshot& snapshot = event.snapshot;
status.encryption_conflicts = snapshot.num_encryption_conflicts();
@@ -44,22 +45,20 @@ SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const {
status.committed_count =
snapshot.model_neutral_state().num_successful_commits;
- if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_BEGIN) {
+ if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_BEGIN) {
status.syncing = true;
- } else if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
+ } else if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
status.syncing = false;
}
status.updates_available += snapshot.num_server_changes_remaining();
- status.sync_protocol_error =
- snapshot.model_neutral_state().sync_protocol_error;
status.num_entries_by_type = snapshot.num_entries_by_type();
status.num_to_delete_entries_by_type =
snapshot.num_to_delete_entries_by_type();
// Accumulate update count only once per session to avoid double-counting.
- if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) {
+ if (event.what_happened == SyncCycleEvent::SYNC_CYCLE_ENDED) {
status.updates_received +=
snapshot.model_neutral_state().num_updates_downloaded_total;
status.tombstone_updates_received +=
@@ -92,33 +91,37 @@ SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const {
return status;
}
-void AllStatus::OnSyncEngineEvent(const SyncEngineEvent& event) {
+void AllStatus::OnSyncCycleEvent(const SyncCycleEvent& event) {
ScopedStatusLock lock(this);
switch (event.what_happened) {
- case SyncEngineEvent::SYNC_CYCLE_BEGIN:
- case SyncEngineEvent::STATUS_CHANGED:
- case SyncEngineEvent::SYNC_CYCLE_ENDED:
+ case SyncCycleEvent::SYNC_CYCLE_BEGIN:
+ case SyncCycleEvent::STATUS_CHANGED:
+ case SyncCycleEvent::SYNC_CYCLE_ENDED:
status_ = CalcSyncing(event);
break;
- case SyncEngineEvent::STOP_SYNCING_PERMANENTLY:
- break;
- case SyncEngineEvent::ACTIONABLE_ERROR:
- status_ = CreateBlankStatus();
- status_.sync_protocol_error =
- event.snapshot.model_neutral_state().sync_protocol_error;
- break;
- case SyncEngineEvent::RETRY_TIME_CHANGED:
- status_.retry_time = event.retry_time;
- break;
- case SyncEngineEvent::THROTTLED_TYPES_CHANGED:
- status_.throttled_types = event.throttled_types;
- break;
default:
LOG(ERROR) << "Unrecognized Syncer Event: " << event.what_happened;
break;
}
}
+void AllStatus::OnActionableError(
+ const SyncProtocolError& sync_protocol_error) {
+ ScopedStatusLock lock(this);
+ status_ = CreateBlankStatus();
+ status_.sync_protocol_error = sync_protocol_error;
+}
+
+void AllStatus::OnRetryTimeChanged(base::Time retry_time) {
+ ScopedStatusLock lock(this);
+ status_.retry_time = retry_time;
+}
+
+void AllStatus::OnThrottledTypesChanged(ModelTypeSet throttled_types) {
+ ScopedStatusLock lock(this);
+ status_.throttled_types = throttled_types;
+}
+
SyncStatus AllStatus::status() const {
base::AutoLock lock(mutex_);
return status_;
diff --git a/sync/engine/all_status.h b/sync/engine/all_status.h
index 8954eae..b30d2ae 100644
--- a/sync/engine/all_status.h
+++ b/sync/engine/all_status.h
@@ -13,7 +13,7 @@
#include "base/compiler_specific.h"
#include "base/synchronization/lock.h"
-#include "sync/engine/sync_engine_event.h"
+#include "sync/engine/sync_engine_event_listener.h"
#include "sync/engine/syncer_types.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/engine/sync_status.h"
@@ -23,6 +23,7 @@ namespace syncer {
class ScopedStatusLock;
struct ServerConnectionEvent;
+struct SyncCycleEvent;
// This class collects data and uses it to update its internal state. It can
// return a snapshot of this state as a SyncerStatus object.
@@ -39,7 +40,11 @@ class AllStatus : public SyncEngineEventListener {
AllStatus();
virtual ~AllStatus();
- virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE;
+ // SyncEngineEventListener implementation.
+ virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE;
+ virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE;
+ virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE;
+ virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE;
SyncStatus status() const;
@@ -64,7 +69,7 @@ class AllStatus : public SyncEngineEventListener {
protected:
// Examines syncer to calculate syncing and the unsynced count,
// and returns a Status with new values.
- SyncStatus CalcSyncing(const SyncEngineEvent& event) const;
+ SyncStatus CalcSyncing(const SyncCycleEvent& event) const;
SyncStatus CreateBlankStatus() const;
SyncStatus status_;
diff --git a/sync/engine/sync_cycle_event.cc b/sync/engine/sync_cycle_event.cc
new file mode 100644
index 0000000..e09e4c0
--- /dev/null
+++ b/sync/engine/sync_cycle_event.cc
@@ -0,0 +1,14 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/engine/sync_cycle_event.h"
+
+namespace syncer {
+
+SyncCycleEvent::SyncCycleEvent(EventCause cause) : what_happened(cause) {
+}
+
+SyncCycleEvent::~SyncCycleEvent() {}
+
+} // namespace syncer
diff --git a/sync/engine/sync_cycle_event.h b/sync/engine/sync_cycle_event.h
new file mode 100644
index 0000000..0f1a04d
--- /dev/null
+++ b/sync/engine/sync_cycle_event.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_ENGINE_SYNC_CYCLE_EVENT_H_
+#define SYNC_ENGINE_SYNC_CYCLE_EVENT_H_
+
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
+
+namespace syncer {
+
+struct SyncProtocolError;
+
+struct SYNC_EXPORT_PRIVATE SyncCycleEvent {
+ enum EventCause {
+ ////////////////////////////////////////////////////////////////
+ // Sent on entry of Syncer state machine
+ SYNC_CYCLE_BEGIN,
+
+ // Sent any time progress is made during a sync cycle.
+ STATUS_CHANGED,
+
+ // We have reached the SYNCER_END state in the main sync loop.
+ SYNC_CYCLE_ENDED,
+ };
+
+ explicit SyncCycleEvent(EventCause cause);
+ ~SyncCycleEvent();
+
+ EventCause what_happened;
+
+ // The last session used for syncing.
+ sessions::SyncSessionSnapshot snapshot;
+};
+
+} // namespace syncer
+
+#endif // SYNC_ENGINE_SYNC_CYCLE_EVENT_H_
diff --git a/sync/engine/sync_engine_event.cc b/sync/engine/sync_engine_event.cc
deleted file mode 100644
index 2df3d62..0000000
--- a/sync/engine/sync_engine_event.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sync/engine/sync_engine_event.h"
-
-namespace syncer {
-
-SyncEngineEvent::SyncEngineEvent(EventCause cause) : what_happened(cause) {
-}
-
-SyncEngineEvent::~SyncEngineEvent() {}
-
-} // namespace syncer
diff --git a/sync/engine/sync_engine_event.h b/sync/engine/sync_engine_event.h
deleted file mode 100644
index 026d329..0000000
--- a/sync/engine/sync_engine_event.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SYNC_ENGINE_SYNC_ENGINE_EVENT_H_
-#define SYNC_ENGINE_SYNC_ENGINE_EVENT_H_
-
-#include <string>
-
-#include "base/observer_list.h"
-#include "sync/base/sync_export.h"
-#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
-
-namespace syncable {
-class Id;
-}
-
-namespace syncer {
-
-struct SYNC_EXPORT_PRIVATE SyncEngineEvent {
- enum EventCause {
- ////////////////////////////////////////////////////////////////
- // Sent on entry of Syncer state machine
- SYNC_CYCLE_BEGIN,
-
- // Sent any time progress is made during a sync cycle.
- STATUS_CHANGED,
-
- // We have reached the SYNCER_END state in the main sync loop.
- SYNC_CYCLE_ENDED,
-
- ////////////////////////////////////////////////////////////////
- // Generated in response to specific protocol actions or events.
-
- // This is sent after the Syncer (and SyncerThread) have initiated self
- // halt due to no longer being permitted to communicate with the server.
- // The listener should sever the sync / browser connections and delete sync
- // data (i.e. as if the user clicked 'Stop Syncing' in the browser.
- STOP_SYNCING_PERMANENTLY,
-
- // This event is sent when we receive an actionable error. It is upto
- // the listeners to figure out the action to take using the snapshot sent.
- ACTIONABLE_ERROR,
-
- // This event is sent when scheduler decides to wait before next request
- // either because it gets throttled by server or because it backs off after
- // request failure. Retry time is passed in retry_time field of event.
- RETRY_TIME_CHANGED,
-
- // This event is sent when types are throttled or unthrottled.
- THROTTLED_TYPES_CHANGED,
- };
-
- explicit SyncEngineEvent(EventCause cause);
- ~SyncEngineEvent();
-
- EventCause what_happened;
-
- // The last session used for syncing.
- sessions::SyncSessionSnapshot snapshot;
-
- // Update-Client-Auth returns a new token for sync use.
- std::string updated_token;
-
- // Time when scheduler will try to send request after backoff.
- base::Time retry_time;
-
- // Set of types that are currently throttled.
- ModelTypeSet throttled_types;
-};
-
-class SYNC_EXPORT_PRIVATE SyncEngineEventListener {
- public:
- // TODO(tim): Consider splitting this up to multiple callbacks, rather than
- // have to do Event e(type); OnSyncEngineEvent(e); at all callsites,
- virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0;
- protected:
- virtual ~SyncEngineEventListener() {}
-};
-
-} // namespace syncer
-
-#endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_H_
diff --git a/sync/engine/sync_engine_event_listener.cc b/sync/engine/sync_engine_event_listener.cc
new file mode 100644
index 0000000..90fe8c7
--- /dev/null
+++ b/sync/engine/sync_engine_event_listener.cc
@@ -0,0 +1,13 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/engine/sync_engine_event_listener.h"
+
+namespace syncer {
+
+SyncEngineEventListener::SyncEngineEventListener() {}
+
+SyncEngineEventListener::~SyncEngineEventListener() {}
+
+} // namespace syncer
diff --git a/sync/engine/sync_engine_event_listener.h b/sync/engine/sync_engine_event_listener.h
new file mode 100644
index 0000000..8e5c3d5
--- /dev/null
+++ b/sync/engine/sync_engine_event_listener.h
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_
+#define SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_
+
+#include "base/time/time.h"
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/base/model_type.h"
+
+namespace syncer {
+
+struct SyncProtocolError;
+struct SyncCycleEvent;
+
+class SYNC_EXPORT_PRIVATE SyncEngineEventListener {
+ public:
+ SyncEngineEventListener();
+
+ // Generated at various points during the sync cycle.
+ virtual void OnSyncCycleEvent(const SyncCycleEvent& event) = 0;
+
+ // This event is sent when we receive an actionable error. It is up to
+ // the listeners to figure out the action to take using the error sent.
+ virtual void OnActionableError(const SyncProtocolError& error) = 0;
+
+ // This event is sent when scheduler decides to wait before next request
+ // either because it gets throttled by server or because it backs off after
+ // request failure. Retry time is passed in retry_time field of event.
+ virtual void OnRetryTimeChanged(base::Time retry_time) = 0;
+
+ // This event is sent when types are throttled or unthrottled.
+ virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) = 0;
+
+ protected:
+ virtual ~SyncEngineEventListener();
+};
+
+} // namespace syncer
+
+#endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc
index 315ec95..1399331 100644
--- a/sync/engine/sync_scheduler_impl.cc
+++ b/sync/engine/sync_scheduler_impl.cc
@@ -254,9 +254,11 @@ ModelTypeSet SyncSchedulerImpl::GetEnabledAndUnthrottledTypes() {
void SyncSchedulerImpl::SendInitialSnapshot() {
DCHECK(CalledOnValidThread());
scoped_ptr<SyncSession> dummy(SyncSession::Build(session_context_, this));
- SyncEngineEvent event(SyncEngineEvent::STATUS_CHANGED);
+ SyncCycleEvent event(SyncCycleEvent::STATUS_CHANGED);
event.snapshot = dummy->TakeSnapshot();
- session_context_->NotifyListeners(event);
+ FOR_EACH_OBSERVER(SyncEngineEventListener,
+ *session_context_->listeners(),
+ OnSyncCycleEvent(event));
}
namespace {
@@ -810,21 +812,16 @@ void SyncSchedulerImpl::ExponentialBackoffRetry() {
TryCanaryJob();
}
-void SyncSchedulerImpl::Notify(SyncEngineEvent::EventCause cause) {
- DCHECK(CalledOnValidThread());
- session_context_->NotifyListeners(SyncEngineEvent(cause));
-}
-
void SyncSchedulerImpl::NotifyRetryTime(base::Time retry_time) {
- SyncEngineEvent event(SyncEngineEvent::RETRY_TIME_CHANGED);
- event.retry_time = retry_time;
- session_context_->NotifyListeners(event);
+ FOR_EACH_OBSERVER(SyncEngineEventListener,
+ *session_context_->listeners(),
+ OnRetryTimeChanged(retry_time));
}
void SyncSchedulerImpl::NotifyThrottledTypesChanged(ModelTypeSet types) {
- SyncEngineEvent event(SyncEngineEvent::THROTTLED_TYPES_CHANGED);
- event.throttled_types = types;
- session_context_->NotifyListeners(event);
+ FOR_EACH_OBSERVER(SyncEngineEventListener,
+ *session_context_->listeners(),
+ OnThrottledTypesChanged(types));
}
bool SyncSchedulerImpl::IsBackingOff() const {
@@ -888,25 +885,19 @@ void SyncSchedulerImpl::OnReceivedClientInvalidationHintBufferSize(int size) {
NOTREACHED() << "Hint buffer size should be > 0.";
}
-void SyncSchedulerImpl::OnActionableError(
- const sessions::SyncSessionSnapshot& snap) {
- DCHECK(CalledOnValidThread());
- SDVLOG(2) << "OnActionableError";
- SyncEngineEvent event(SyncEngineEvent::ACTIONABLE_ERROR);
- event.snapshot = snap;
- session_context_->NotifyListeners(event);
-}
-
void SyncSchedulerImpl::OnSyncProtocolError(
- const sessions::SyncSessionSnapshot& snapshot) {
+ const SyncProtocolError& sync_protocol_error) {
DCHECK(CalledOnValidThread());
- if (ShouldRequestEarlyExit(
- snapshot.model_neutral_state().sync_protocol_error)) {
+ if (ShouldRequestEarlyExit(sync_protocol_error)) {
SDVLOG(2) << "Sync Scheduler requesting early exit.";
Stop();
}
- if (IsActionableError(snapshot.model_neutral_state().sync_protocol_error))
- OnActionableError(snapshot);
+ if (IsActionableError(sync_protocol_error)) {
+ SDVLOG(2) << "OnActionableError";
+ FOR_EACH_OBSERVER(SyncEngineEventListener,
+ *session_context_->listeners(),
+ OnActionableError(sync_protocol_error));
+ }
}
void SyncSchedulerImpl::OnReceivedGuRetryDelay(const base::TimeDelta& delay) {
diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h
index 063b0bd9..1c190c8 100644
--- a/sync/engine/sync_scheduler_impl.h
+++ b/sync/engine/sync_scheduler_impl.h
@@ -88,7 +88,7 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
const base::TimeDelta& new_delay) OVERRIDE;
virtual void OnReceivedClientInvalidationHintBufferSize(int size) OVERRIDE;
virtual void OnSyncProtocolError(
- const sessions::SyncSessionSnapshot& snapshot) OVERRIDE;
+ const SyncProtocolError& sync_protocol_error) OVERRIDE;
virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) OVERRIDE;
// Returns true if the client is currently in exponential backoff.
@@ -187,9 +187,6 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
const base::TimeDelta& delay,
const tracked_objects::Location& nudge_location);
- // Helper to signal all listeners registered with |session_context_|.
- void Notify(SyncEngineEvent::EventCause cause);
-
// Helper to signal listeners about changed retry time.
void NotifyRetryTime(base::Time retry_time);
@@ -240,8 +237,6 @@ class SYNC_EXPORT_PRIVATE SyncSchedulerImpl
// is the most flexible place to do this bookkeeping.
void UpdateNudgeTimeRecords(ModelTypeSet types);
- virtual void OnActionableError(const sessions::SyncSessionSnapshot& snapshot);
-
// For certain methods that need to worry about X-thread posting.
WeakHandle<SyncSchedulerImpl> weak_handle_this_;
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc
index 892eff5..629635d 100644
--- a/sync/engine/syncer.cc
+++ b/sync/engine/syncer.cc
@@ -179,7 +179,7 @@ void Syncer::ApplyUpdates(SyncSession* session,
session->context()->set_hierarchy_conflict_detected(
session->status_controller().num_hierarchy_conflicts() > 0);
- session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED);
+ session->SendEventNotification(SyncCycleEvent::STATUS_CHANGED);
}
bool Syncer::DownloadUpdates(
@@ -242,7 +242,7 @@ SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types,
void Syncer::HandleCycleBegin(SyncSession* session) {
session->mutable_status_controller()->UpdateStartTime();
- session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN);
+ session->SendEventNotification(SyncCycleEvent::SYNC_CYCLE_BEGIN);
}
bool Syncer::HandleCycleEnd(
diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc
index bcc0bd4..62fec65 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -398,12 +398,8 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
response->error_code());
}
- // Now set the error into the status so the layers above us could read it.
- sessions::StatusController* status = session->mutable_status_controller();
- status->set_sync_protocol_error(sync_protocol_error);
-
// Inform the delegate of the error we got.
- session->delegate()->OnSyncProtocolError(session->TakeSnapshot());
+ session->delegate()->OnSyncProtocolError(sync_protocol_error);
// Update our state for any other commands we've received.
if (response->has_client_command()) {
diff --git a/sync/engine/syncer_proto_util_unittest.cc b/sync/engine/syncer_proto_util_unittest.cc
index 39f4fddb..d43b350 100644
--- a/sync/engine/syncer_proto_util_unittest.cc
+++ b/sync/engine/syncer_proto_util_unittest.cc
@@ -44,7 +44,7 @@ class MockDelegate : public sessions::SyncSession::Delegate {
MOCK_METHOD1(OnReceivedLongPollIntervalUpdate ,void(const base::TimeDelta&));
MOCK_METHOD1(OnReceivedSessionsCommitDelay, void(const base::TimeDelta&));
MOCK_METHOD1(OnReceivedClientInvalidationHintBufferSize, void(int));
- MOCK_METHOD1(OnSyncProtocolError, void(const sessions::SyncSessionSnapshot&));
+ MOCK_METHOD1(OnSyncProtocolError, void(const SyncProtocolError&));
MOCK_METHOD1(OnSilencedUntil, void(const base::TimeTicks&));
};
diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
index d4ff18d..3cff01d 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -151,9 +151,7 @@ class SyncerTest : public testing::Test,
last_client_invalidation_hint_buffer_size_ = size;
}
virtual void OnReceivedGuRetryDelay(const base::TimeDelta& delay) OVERRIDE {}
- virtual void OnSyncProtocolError(
- const sessions::SyncSessionSnapshot& snapshot) OVERRIDE {
- }
+ virtual void OnSyncProtocolError(const SyncProtocolError& error) OVERRIDE {}
void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
// We're just testing the sync engine here, so we shunt everything to
@@ -164,13 +162,13 @@ class SyncerTest : public testing::Test,
}
}
- virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE {
+ virtual void OnSyncCycleEvent(const SyncCycleEvent& event) OVERRIDE {
DVLOG(1) << "HandleSyncEngineEvent in unittest " << event.what_happened;
// we only test for entry-specific events, not status changed ones.
switch (event.what_happened) {
- case SyncEngineEvent::SYNC_CYCLE_BEGIN: // Fall through.
- case SyncEngineEvent::STATUS_CHANGED:
- case SyncEngineEvent::SYNC_CYCLE_ENDED:
+ case SyncCycleEvent::SYNC_CYCLE_BEGIN: // Fall through.
+ case SyncCycleEvent::STATUS_CHANGED:
+ case SyncCycleEvent::SYNC_CYCLE_ENDED:
return;
default:
CHECK(false) << "Handling unknown error type in unit tests!!";
@@ -178,6 +176,10 @@ class SyncerTest : public testing::Test,
saw_syncer_event_ = true;
}
+ virtual void OnActionableError(const SyncProtocolError& error) OVERRIDE {}
+ virtual void OnRetryTimeChanged(base::Time retry_time) OVERRIDE {}
+ virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) OVERRIDE {}
+
void ResetSession() {
session_.reset(SyncSession::Build(context_.get(), this));
}