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

Side by Side Diff: components/sync_driver/generic_change_processor_unittest.cc

Issue 263903004: Add AttachmentUploader interface and fake implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/sync_driver/generic_change_processor.h" 5 #include "components/sync_driver/generic_change_processor.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "components/sync_driver/data_type_error_handler_mock.h" 11 #include "components/sync_driver/data_type_error_handler_mock.h"
12 #include "sync/api/attachments/fake_attachment_service.h" 12 #include "sync/api/attachments/fake_attachment_service.h"
13 #include "sync/api/attachments/fake_attachment_store.h" 13 #include "sync/api/attachments/fake_attachment_store.h"
14 #include "sync/api/attachments/fake_attachment_uploader.h"
14 #include "sync/api/fake_syncable_service.h" 15 #include "sync/api/fake_syncable_service.h"
15 #include "sync/api/sync_change.h" 16 #include "sync/api/sync_change.h"
16 #include "sync/api/sync_merge_result.h" 17 #include "sync/api/sync_merge_result.h"
17 #include "sync/internal_api/public/base/model_type.h" 18 #include "sync/internal_api/public/base/model_type.h"
18 #include "sync/internal_api/public/read_node.h" 19 #include "sync/internal_api/public/read_node.h"
19 #include "sync/internal_api/public/read_transaction.h" 20 #include "sync/internal_api/public/read_transaction.h"
20 #include "sync/internal_api/public/sync_encryption_handler.h" 21 #include "sync/internal_api/public/sync_encryption_handler.h"
21 #include "sync/internal_api/public/test/test_user_share.h" 22 #include "sync/internal_api/public/test/test_user_share.h"
22 #include "sync/internal_api/public/user_share.h" 23 #include "sync/internal_api/public/user_share.h"
23 #include "sync/internal_api/public/write_node.h" 24 #include "sync/internal_api/public/write_node.h"
(...skipping 13 matching lines...) Expand all
37 virtual ~MockAttachmentService(); 38 virtual ~MockAttachmentService();
38 virtual void StoreAttachments(const syncer::AttachmentList& attachments, 39 virtual void StoreAttachments(const syncer::AttachmentList& attachments,
39 const StoreCallback& callback) OVERRIDE; 40 const StoreCallback& callback) OVERRIDE;
40 std::vector<syncer::AttachmentList>* attachment_lists(); 41 std::vector<syncer::AttachmentList>* attachment_lists();
41 42
42 private: 43 private:
43 std::vector<syncer::AttachmentList> attachment_lists_; 44 std::vector<syncer::AttachmentList> attachment_lists_;
44 }; 45 };
45 46
46 MockAttachmentService::MockAttachmentService() 47 MockAttachmentService::MockAttachmentService()
47 : FakeAttachmentService(scoped_ptr<syncer::AttachmentStore>( 48 : FakeAttachmentService(
48 new syncer::FakeAttachmentStore(base::MessageLoopProxy::current()))) { 49 scoped_ptr<syncer::AttachmentStore>(new syncer::FakeAttachmentStore(
50 base::MessageLoopProxy::current())),
51 scoped_ptr<syncer::AttachmentUploader>(
52 new syncer::FakeAttachmentUploader)) {
49 } 53 }
50 54
51 MockAttachmentService::~MockAttachmentService() { 55 MockAttachmentService::~MockAttachmentService() {
52 } 56 }
53 57
54 void MockAttachmentService::StoreAttachments( 58 void MockAttachmentService::StoreAttachments(
55 const syncer::AttachmentList& attachments, 59 const syncer::AttachmentList& attachments,
56 const StoreCallback& callback) { 60 const StoreCallback& callback) {
57 attachment_lists_.push_back(attachments); 61 attachment_lists_.push_back(attachments);
58 FakeAttachmentService::StoreAttachments(attachments, callback); 62 FakeAttachmentService::StoreAttachments(attachments, callback);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 ASSERT_EQ(mock_attachment_service()->attachment_lists()->size(), 1U); 342 ASSERT_EQ(mock_attachment_service()->attachment_lists()->size(), 1U);
339 const syncer::AttachmentList& new_attachments_added = 343 const syncer::AttachmentList& new_attachments_added =
340 mock_attachment_service()->attachment_lists()->front(); 344 mock_attachment_service()->attachment_lists()->front();
341 ASSERT_EQ(new_attachments_added.size(), 1U); 345 ASSERT_EQ(new_attachments_added.size(), 1U);
342 ASSERT_EQ(new_attachments_added[0].GetId(), new_attachments[0].GetId()); 346 ASSERT_EQ(new_attachments_added[0].GetId(), new_attachments[0].GetId());
343 } 347 }
344 348
345 } // namespace 349 } // namespace
346 350
347 } // namespace browser_sync 351 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/shared_change_processor.cc ('k') | sync/api/attachments/attachment_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698