OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/download_updates_command.h" | 5 #include "chrome/browser/sync/engine/download_updates_command.h" |
6 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 6 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
8 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" | 8 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" |
9 #include "chrome/browser/sync/protocol/sync.pb.h" | 9 #include "chrome/browser/sync/protocol/sync.pb.h" |
10 #include "chrome/browser/sync/syncable/directory_manager.h" | 10 #include "chrome/browser/sync/syncable/directory_manager.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 DownloadUpdatesCommand command_; | 39 DownloadUpdatesCommand command_; |
40 | 40 |
41 private: | 41 private: |
42 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest); | 42 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest); |
43 }; | 43 }; |
44 | 44 |
45 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { | 45 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { |
46 ConfigureMockServerConnection(); | 46 ConfigureMockServerConnection(); |
47 mock_server()->ExpectGetUpdatesRequestTypes( | 47 mock_server()->ExpectGetUpdatesRequestTypes( |
48 ModelTypeBitSetFromSet(GetRoutingInfoTypes(routing_info()))); | 48 GetRoutingInfoTypes(routing_info())); |
49 command_.ExecuteImpl(session()); | 49 command_.ExecuteImpl(session()); |
50 } | 50 } |
51 | 51 |
52 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { | 52 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { |
53 ConfigureMockServerConnection(); | 53 ConfigureMockServerConnection(); |
54 sessions::SyncSourceInfo source; | 54 sessions::SyncSourceInfo source; |
55 source.types[syncable::AUTOFILL] = "autofill_payload"; | 55 source.types[syncable::AUTOFILL] = "autofill_payload"; |
56 source.types[syncable::BOOKMARKS] = "bookmark_payload"; | 56 source.types[syncable::BOOKMARKS] = "bookmark_payload"; |
57 source.types[syncable::PREFERENCES] = "preferences_payload"; | 57 source.types[syncable::PREFERENCES] = "preferences_payload"; |
58 mock_server()->ExpectGetUpdatesRequestTypes( | 58 mock_server()->ExpectGetUpdatesRequestTypes( |
59 ModelTypeBitSetFromSet(GetRoutingInfoTypes(routing_info()))); | 59 GetRoutingInfoTypes(routing_info())); |
60 mock_server()->ExpectGetUpdatesRequestPayloads(source.types); | 60 mock_server()->ExpectGetUpdatesRequestPayloads(source.types); |
61 command_.ExecuteImpl(session(source)); | 61 command_.ExecuteImpl(session(source)); |
62 } | 62 } |
63 | 63 |
64 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) { | 64 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) { |
65 sync_pb::DebugInfo debug_info; | 65 sync_pb::DebugInfo debug_info; |
66 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) | 66 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) |
67 .Times(1); | 67 .Times(1); |
68 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); | 68 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); |
69 | 69 |
70 // Now try to add it once more and make sure |GetAndClearDebugInfo| is not | 70 // Now try to add it once more and make sure |GetAndClearDebugInfo| is not |
71 // called. | 71 // called. |
72 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); | 72 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); |
73 } | 73 } |
74 | 74 |
75 } // namespace browser_sync | 75 } // namespace browser_sync |
OLD | NEW |