OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/engine/build_commit_command.h" | 5 #include "sync/engine/build_commit_command.h" |
6 #include "sync/test/engine/syncer_command_test.h" | 6 #include "sync/test/engine/syncer_command_test.h" |
7 | 7 |
8 namespace syncer { | 8 namespace syncer { |
9 | 9 |
10 // A test fixture for tests exercising ClearDataCommandTest. | 10 // A test fixture for tests exercising ClearDataCommandTest. |
11 class BuildCommitCommandTest : public SyncerCommandTest { | 11 class BuildCommitCommandTest : public SyncerCommandTest { |
12 protected: | 12 protected: |
13 BuildCommitCommandTest() | 13 BuildCommitCommandTest() |
14 : batch_commit_set_(ModelSafeRoutingInfo()), | 14 : batch_commit_set_(ModelSafeRoutingInfo()), |
15 command_(batch_commit_set_, &commit_message_) { | 15 command_(batch_commit_set_, &commit_message_) { |
16 } | 16 } |
17 | 17 |
18 private: | 18 private: |
19 sessions::OrderedCommitSet batch_commit_set_; | 19 sessions::OrderedCommitSet batch_commit_set_; |
20 ClientToServerMessage commit_message_; | 20 sync_pb::ClientToServerMessage commit_message_; |
21 | 21 |
22 protected: | 22 protected: |
23 BuildCommitCommand command_; | 23 BuildCommitCommand command_; |
24 | 24 |
25 private: | 25 private: |
26 DISALLOW_COPY_AND_ASSIGN(BuildCommitCommandTest); | 26 DISALLOW_COPY_AND_ASSIGN(BuildCommitCommandTest); |
27 }; | 27 }; |
28 | 28 |
29 TEST_F(BuildCommitCommandTest, InterpolatePosition) { | 29 TEST_F(BuildCommitCommandTest, InterpolatePosition) { |
30 EXPECT_LT(BuildCommitCommand::GetFirstPosition(), | 30 EXPECT_LT(BuildCommitCommand::GetFirstPosition(), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 command_.InterpolatePosition(BuildCommitCommand::GetFirstPosition(), -1)); | 96 command_.InterpolatePosition(BuildCommitCommand::GetFirstPosition(), -1)); |
97 EXPECT_EQ(BuildCommitCommand::GetGap() / 8, | 97 EXPECT_EQ(BuildCommitCommand::GetGap() / 8, |
98 command_.InterpolatePosition(0, BuildCommitCommand::GetGap())); | 98 command_.InterpolatePosition(0, BuildCommitCommand::GetGap())); |
99 EXPECT_EQ(BuildCommitCommand::GetGap() / 4, | 99 EXPECT_EQ(BuildCommitCommand::GetGap() / 4, |
100 command_.InterpolatePosition(0, BuildCommitCommand::GetGap()*2)); | 100 command_.InterpolatePosition(0, BuildCommitCommand::GetGap()*2)); |
101 EXPECT_EQ(BuildCommitCommand::GetGap(), | 101 EXPECT_EQ(BuildCommitCommand::GetGap(), |
102 command_.InterpolatePosition(0, BuildCommitCommand::GetGap()*2 + 1)); | 102 command_.InterpolatePosition(0, BuildCommitCommand::GetGap()*2 + 1)); |
103 } | 103 } |
104 | 104 |
105 } // namespace syncer | 105 } // namespace syncer |
OLD | NEW |