| OLD | NEW |
| 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 "sync/internal_api/public/attachments/attachment_store_handle.h" | 5 #include "sync/internal_api/public/attachments/attachment_store_handle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 MockAttachmentStore(const base::Closure& read_called, | 24 MockAttachmentStore(const base::Closure& read_called, |
| 25 const base::Closure& write_called, | 25 const base::Closure& write_called, |
| 26 const base::Closure& drop_called, | 26 const base::Closure& drop_called, |
| 27 const base::Closure& dtor_called) | 27 const base::Closure& dtor_called) |
| 28 : read_called_(read_called), | 28 : read_called_(read_called), |
| 29 write_called_(write_called), | 29 write_called_(write_called), |
| 30 drop_called_(drop_called), | 30 drop_called_(drop_called), |
| 31 dtor_called_(dtor_called) {} | 31 dtor_called_(dtor_called) {} |
| 32 | 32 |
| 33 virtual ~MockAttachmentStore() { | 33 ~MockAttachmentStore() override { dtor_called_.Run(); } |
| 34 dtor_called_.Run(); | |
| 35 } | |
| 36 | 34 |
| 37 virtual void Read(const AttachmentIdList& ids, | 35 void Read(const AttachmentIdList& ids, |
| 38 const ReadCallback& callback) override { | 36 const ReadCallback& callback) override { |
| 39 read_called_.Run(); | 37 read_called_.Run(); |
| 40 } | 38 } |
| 41 | 39 |
| 42 virtual void Write(const AttachmentList& attachments, | 40 void Write(const AttachmentList& attachments, |
| 43 const WriteCallback& callback) override { | 41 const WriteCallback& callback) override { |
| 44 write_called_.Run(); | 42 write_called_.Run(); |
| 45 } | 43 } |
| 46 | 44 |
| 47 virtual void Drop(const AttachmentIdList& ids, | 45 void Drop(const AttachmentIdList& ids, |
| 48 const DropCallback& callback) override { | 46 const DropCallback& callback) override { |
| 49 drop_called_.Run(); | 47 drop_called_.Run(); |
| 50 } | 48 } |
| 51 | 49 |
| 52 base::Closure read_called_; | 50 base::Closure read_called_; |
| 53 base::Closure write_called_; | 51 base::Closure write_called_; |
| 54 base::Closure drop_called_; | 52 base::Closure drop_called_; |
| 55 base::Closure dtor_called_; | 53 base::Closure dtor_called_; |
| 56 }; | 54 }; |
| 57 | 55 |
| 58 } // namespace | 56 } // namespace |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 133 |
| 136 // Releasing referehce to AttachmentStoreHandle should result in | 134 // Releasing referehce to AttachmentStoreHandle should result in |
| 137 // MockAttachmentStore being deleted on backend loop. | 135 // MockAttachmentStore being deleted on backend loop. |
| 138 attachment_store_handle_ = NULL; | 136 attachment_store_handle_ = NULL; |
| 139 EXPECT_EQ(dtor_call_count_, 0); | 137 EXPECT_EQ(dtor_call_count_, 0); |
| 140 RunMessageLoop(); | 138 RunMessageLoop(); |
| 141 EXPECT_EQ(dtor_call_count_, 1); | 139 EXPECT_EQ(dtor_call_count_, 1); |
| 142 } | 140 } |
| 143 | 141 |
| 144 } // namespace syncer | 142 } // namespace syncer |
| OLD | NEW |