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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 months 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
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/engine/get_commit_ids_command.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "sync/test/engine/syncer_command_test.h" 11 #include "sync/test/engine/syncer_command_test.h"
12 12
13 using ::testing::_; 13 using ::testing::_;
14
14 namespace syncer { 15 namespace syncer {
15 16
16 using syncable::FIRST_REAL_MODEL_TYPE;
17 using syncable::MODEL_TYPE_COUNT;
18
19 // A test fixture for tests exercising DownloadUpdatesCommandTest. 17 // A test fixture for tests exercising DownloadUpdatesCommandTest.
20 class DownloadUpdatesCommandTest : public SyncerCommandTest { 18 class DownloadUpdatesCommandTest : public SyncerCommandTest {
21 protected: 19 protected:
22 DownloadUpdatesCommandTest() 20 DownloadUpdatesCommandTest()
23 : command_(true /* create_mobile_bookmarks_folder */) {} 21 : command_(true /* create_mobile_bookmarks_folder */) {}
24 22
25 virtual void SetUp() { 23 virtual void SetUp() {
26 workers()->clear(); 24 workers()->clear();
27 mutable_routing_info()->clear(); 25 mutable_routing_info()->clear();
28 workers()->push_back( 26 workers()->push_back(
29 make_scoped_refptr(new FakeModelWorker(GROUP_DB))); 27 make_scoped_refptr(new FakeModelWorker(GROUP_DB)));
30 workers()->push_back( 28 workers()->push_back(
31 make_scoped_refptr(new FakeModelWorker(GROUP_UI))); 29 make_scoped_refptr(new FakeModelWorker(GROUP_UI)));
32 (*mutable_routing_info())[syncable::AUTOFILL] = GROUP_DB; 30 (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_DB;
33 (*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI; 31 (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI;
34 (*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI; 32 (*mutable_routing_info())[syncer::PREFERENCES] = GROUP_UI;
35 SyncerCommandTest::SetUp(); 33 SyncerCommandTest::SetUp();
36 } 34 }
37 35
38 DownloadUpdatesCommand command_; 36 DownloadUpdatesCommand command_;
39 37
40 private: 38 private:
41 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest); 39 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommandTest);
42 }; 40 };
43 41
44 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { 42 TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) {
45 ConfigureMockServerConnection(); 43 ConfigureMockServerConnection();
46 mock_server()->ExpectGetUpdatesRequestTypes( 44 mock_server()->ExpectGetUpdatesRequestTypes(
47 GetRoutingInfoTypes(routing_info())); 45 GetRoutingInfoTypes(routing_info()));
48 command_.ExecuteImpl(session()); 46 command_.ExecuteImpl(session());
49 } 47 }
50 48
51 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { 49 TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) {
52 ConfigureMockServerConnection(); 50 ConfigureMockServerConnection();
53 sessions::SyncSourceInfo source; 51 sessions::SyncSourceInfo source;
54 source.types[syncable::AUTOFILL] = "autofill_payload"; 52 source.types[syncer::AUTOFILL] = "autofill_payload";
55 source.types[syncable::BOOKMARKS] = "bookmark_payload"; 53 source.types[syncer::BOOKMARKS] = "bookmark_payload";
56 source.types[syncable::PREFERENCES] = "preferences_payload"; 54 source.types[syncer::PREFERENCES] = "preferences_payload";
57 mock_server()->ExpectGetUpdatesRequestTypes( 55 mock_server()->ExpectGetUpdatesRequestTypes(
58 GetRoutingInfoTypes(routing_info())); 56 GetRoutingInfoTypes(routing_info()));
59 mock_server()->ExpectGetUpdatesRequestPayloads(source.types); 57 mock_server()->ExpectGetUpdatesRequestPayloads(source.types);
60 command_.ExecuteImpl(session(source)); 58 command_.ExecuteImpl(session(source));
61 } 59 }
62 60
63 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) { 61 TEST_F(DownloadUpdatesCommandTest, VerifyAppendDebugInfo) {
64 sync_pb::DebugInfo debug_info; 62 sync_pb::DebugInfo debug_info;
65 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_)) 63 EXPECT_CALL(*(mock_debug_info_getter()), GetAndClearDebugInfo(_))
66 .Times(1); 64 .Times(1);
67 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); 65 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info);
68 66
69 // 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
70 // called. 68 // called.
71 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info); 69 command_.AppendClientDebugInfoIfNeeded(session(), &debug_info);
72 } 70 }
73 71
74 } // namespace syncer 72 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/download_updates_command.cc ('k') | sync/engine/get_commit_ids_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698