fake_invalidator.cc revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "sync/notifier/fake_invalidator.h"
6
7namespace syncer {
8
9FakeInvalidator::FakeInvalidator() {}
10
11FakeInvalidator::~FakeInvalidator() {}
12
13bool FakeInvalidator::IsHandlerRegistered(InvalidationHandler* handler) const {
14  return registrar_.IsHandlerRegisteredForTest(handler);
15}
16
17ObjectIdSet FakeInvalidator::GetRegisteredIds(
18    InvalidationHandler* handler) const {
19  return registrar_.GetRegisteredIds(handler);
20}
21
22const std::string& FakeInvalidator::GetCredentialsEmail() const {
23  return email_;
24}
25
26const std::string& FakeInvalidator::GetCredentialsToken() const {
27  return token_;
28}
29
30void FakeInvalidator::EmitOnInvalidatorStateChange(InvalidatorState state) {
31  registrar_.UpdateInvalidatorState(state);
32}
33
34void FakeInvalidator::EmitOnIncomingInvalidation(
35    const ObjectIdInvalidationMap& invalidation_map) {
36  registrar_.DispatchInvalidationsToHandlers(invalidation_map);
37}
38
39void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) {
40  registrar_.RegisterHandler(handler);
41}
42
43void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler,
44                                          const ObjectIdSet& ids) {
45  registrar_.UpdateRegisteredIds(handler, ids);
46}
47
48void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) {
49  registrar_.UnregisterHandler(handler);
50}
51
52void FakeInvalidator::Acknowledge(const invalidation::ObjectId& id,
53                                  const AckHandle& ack_handle) {
54  // Do nothing.
55}
56
57InvalidatorState FakeInvalidator::GetInvalidatorState() const {
58  return registrar_.GetInvalidatorState();
59}
60
61void FakeInvalidator::UpdateCredentials(
62    const std::string& email, const std::string& token) {
63  email_ = email;
64  token_ = token;
65}
66
67}  // namespace syncer
68