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/download_updates_command.h" | 5 #include "sync/engine/download_updates_command.h" |
6 #include "sync/protocol/autofill_specifics.pb.h" | 6 #include "sync/protocol/autofill_specifics.pb.h" |
7 #include "sync/protocol/bookmark_specifics.pb.h" | 7 #include "sync/protocol/bookmark_specifics.pb.h" |
8 #include "sync/protocol/preference_specifics.pb.h" | 8 #include "sync/protocol/preference_specifics.pb.h" |
9 #include "sync/protocol/sync.pb.h" | 9 #include "sync/protocol/sync.pb.h" |
10 #include "sync/test/engine/fake_model_worker.h" | 10 #include "sync/test/engine/fake_model_worker.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 (*mutable_routing_info())[PREFERENCES] = GROUP_UI; | 32 (*mutable_routing_info())[PREFERENCES] = GROUP_UI; |
33 SyncerCommandTest::SetUp(); | 33 SyncerCommandTest::SetUp(); |
34 } | 34 } |
35 | 35 |
36 DownloadUpdatesCommand command_; | 36 DownloadUpdatesCommand command_; |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest); | 39 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest); |
40 }; | 40 }; |
41 | 41 |
42 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { | 42 TEST_F(DownloadUpdatesCommandTest, ExecuteNoStates) { |
43 ConfigureMockServerConnection(); | 43 ConfigureMockServerConnection(); |
44 mock_server()->ExpectGetUpdatesRequestTypes( | 44 mock_server()->ExpectGetUpdatesRequestTypes( |
45 GetRoutingInfoTypes(routing_info())); | 45 GetRoutingInfoTypes(routing_info())); |
46 command_.ExecuteImpl(session()); | 46 command_.ExecuteImpl(session()); |
47 } | 47 } |
48 | 48 |
49 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { | 49 TEST_F(DownloadUpdatesCommandTest, ExecuteWithStates) { |
50 ConfigureMockServerConnection(); | 50 ConfigureMockServerConnection(); |
51 sessions::SyncSourceInfo source; | 51 sessions::SyncSourceInfo source; |
52 source.types[AUTOFILL] = "autofill_payload"; | 52 source.types[AUTOFILL].payload = "autofill_payload"; |
53 source.types[BOOKMARKS] = "bookmark_payload"; | 53 source.types[BOOKMARKS].payload = "bookmark_payload"; |
54 source.types[PREFERENCES] = "preferences_payload"; | 54 source.types[PREFERENCES].payload = "preferences_payload"; |
55 mock_server()->ExpectGetUpdatesRequestTypes( | 55 mock_server()->ExpectGetUpdatesRequestTypes( |
56 GetRoutingInfoTypes(routing_info())); | 56 GetRoutingInfoTypes(routing_info())); |
57 mock_server()->ExpectGetUpdatesRequestPayloads(source.types); | 57 mock_server()->ExpectGetUpdatesRequestStates(source.types); |
58 command_.ExecuteImpl(session(source)); | 58 command_.ExecuteImpl(session(source)); |
59 } | 59 } |
60 | 60 |
61 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) { | 61 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) { |
62 sync_pb::DebugInfo debug_info; | 62 sync_pb::DebugInfo debug_info; |
63 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) | 63 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) |
64 .Times(1); | 64 .Times(1); |
65 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); | 65 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); |
66 | 66 |
67 // Now try to add it once more and make sure |GetAndClearDebugInfo| is not | 67 // Now try to add it once more and make sure |GetAndClearDebugInfo| is not |
68 // called. | 68 // called. |
69 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); | 69 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); |
70 } | 70 } |
71 | 71 |
72 } // namespace syncer | 72 } // namespace syncer |
OLD | NEW |