1 // Copyright 2014 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/test/mock_invalidation.h"
6
7 #include "base/logging.h"
8 #include "sync/test/mock_invalidation_tracker.h"
9
10 namespace syncer {
11
BuildUnknownVersion()12 scoped_ptr<MockInvalidation> MockInvalidation::BuildUnknownVersion() {
13 return scoped_ptr<MockInvalidation>(
14 new MockInvalidation(true, -1, std::string()));
15 }
16
Build(int64 version,const std::string & payload)17 scoped_ptr<MockInvalidation> MockInvalidation::Build(
18 int64 version,
19 const std::string& payload) {
20 return scoped_ptr<MockInvalidation>(
21 new MockInvalidation(false, version, payload));
22 }
23
~MockInvalidation()24 MockInvalidation::~MockInvalidation() {
25 }
26
IsUnknownVersion() const27 bool MockInvalidation::IsUnknownVersion() const {
28 return is_unknown_version_;
29 }
30
GetPayload() const31 const std::string& MockInvalidation::GetPayload() const {
32 DCHECK(!is_unknown_version_);
33 return payload_;
34 }
35
GetVersion() const36 int64 MockInvalidation::GetVersion() const {
37 DCHECK(!is_unknown_version_);
38 return version_;
39 }
40
Acknowledge()41 void MockInvalidation::Acknowledge() {
42 // Do nothing.
43 }
44
Drop()45 void MockInvalidation::Drop() {
46 // Do nothing.
47 }
48
MockInvalidation(bool is_unknown_version,int64 version,const std::string & payload)49 MockInvalidation::MockInvalidation(bool is_unknown_version,
50 int64 version,
51 const std::string& payload)
52 : is_unknown_version_(is_unknown_version),
53 version_(version),
54 payload_(payload) {
55 }
56
57 } // namespace syncer
58