Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: chrome/browser/sync/engine/download_updates_command_unittest.cc

Issue 8638001: [Sync] Made some sync session member functions const (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix latent bug in StatusController Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 (*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI; 35 (*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI;
36 SyncerCommandTest::SetUp(); 36 SyncerCommandTest::SetUp();
37 } 37 }
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, SetRequestedTypes) {
46 {
47 SCOPED_TRACE("Several enabled datatypes, spread out across groups.");
48 syncable::ModelTypeBitSet enabled_types;
49 enabled_types[syncable::BOOKMARKS] = true;
50 enabled_types[syncable::AUTOFILL] = true;
51 enabled_types[syncable::PREFERENCES] = true;
52 sync_pb::EntitySpecifics get_updates_filter;
53 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
54 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
55 v.ExpectHasExtension(sync_pb::autofill);
56 v.ExpectHasExtension(sync_pb::preference);
57 v.ExpectHasExtension(sync_pb::bookmark);
58 v.ExpectNoOtherFieldsOrExtensions();
59 }
60
61 {
62 SCOPED_TRACE("Top level folders.");
63 syncable::ModelTypeBitSet enabled_types;
64 enabled_types[syncable::TOP_LEVEL_FOLDER] = true;
65 enabled_types[syncable::BOOKMARKS] = true;
66 sync_pb::EntitySpecifics get_updates_filter;
67 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
68 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
69 v.ExpectHasExtension(sync_pb::bookmark);
70 v.ExpectNoOtherFieldsOrExtensions();
71 }
72
73 {
74 SCOPED_TRACE("Bookmarks only.");
75 syncable::ModelTypeBitSet enabled_types;
76 enabled_types[syncable::BOOKMARKS] = true;
77 sync_pb::EntitySpecifics get_updates_filter;
78 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
79 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
80 v.ExpectHasExtension(sync_pb::bookmark);
81 v.ExpectNoOtherFieldsOrExtensions();
82 }
83
84 {
85 SCOPED_TRACE("Autofill only.");
86 syncable::ModelTypeBitSet enabled_types;
87 enabled_types[syncable::AUTOFILL] = true;
88 sync_pb::EntitySpecifics get_updates_filter;
89 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
90 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
91 v.ExpectHasExtension(sync_pb::autofill);
92 v.ExpectNoOtherFieldsOrExtensions();
93 }
94
95 {
96 SCOPED_TRACE("Preferences only.");
97 syncable::ModelTypeBitSet enabled_types;
98 enabled_types[syncable::PREFERENCES] = true;
99 sync_pb::EntitySpecifics get_updates_filter;
100 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
101 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
102 v.ExpectHasExtension(sync_pb::preference);
103 v.ExpectNoOtherFieldsOrExtensions();
104 }
105 }
106
107 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { 45 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) {
108 ConfigureMockServerConnection(); 46 ConfigureMockServerConnection();
109 mock_server()->ExpectGetUpdatesRequestTypes( 47 mock_server()->ExpectGetUpdatesRequestTypes(
110 ModelTypeBitSetFromSet(GetRoutingInfoTypes(routing_info()))); 48 ModelTypeBitSetFromSet(GetRoutingInfoTypes(routing_info())));
111 command_.ExecuteImpl(session()); 49 command_.ExecuteImpl(session());
112 } 50 }
113 51
114 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { 52 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) {
115 ConfigureMockServerConnection(); 53 ConfigureMockServerConnection();
116 sessions::SyncSourceInfo source; 54 sessions::SyncSourceInfo source;
(...skipping 11 matching lines...) Expand all
128 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) 66 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_))
129 .Times(1); 67 .Times(1);
130 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); 68 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info);
131 69
132 // 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
133 // called. 71 // called.
134 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); 72 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info);
135 } 73 }
136 74
137 } // namespace browser_sync 75 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/download_updates_command.cc ('k') | chrome/browser/sync/engine/get_commit_ids_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698