| 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/api/attachments/fake_attachment_store.h" | 5 #include "sync/api/attachments/fake_attachment_store.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 store.Read(id_written, read_callback); | 91 store.Read(id_written, read_callback); |
| 92 ClearAndPumpLoop(); | 92 ClearAndPumpLoop(); |
| 93 EXPECT_EQ(result, AttachmentStore::SUCCESS); | 93 EXPECT_EQ(result, AttachmentStore::SUCCESS); |
| 94 EXPECT_EQ(id_written, attachment->GetId()); | 94 EXPECT_EQ(id_written, attachment->GetId()); |
| 95 EXPECT_EQ(some_data, attachment->GetData()); | 95 EXPECT_EQ(some_data, attachment->GetData()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 TEST_F(FakeAttachmentStoreTest, Read_NotFound) { | 98 TEST_F(FakeAttachmentStoreTest, Read_NotFound) { |
| 99 FakeAttachmentStore store(base::MessageLoopProxy::current()); | 99 FakeAttachmentStore store(base::MessageLoopProxy::current()); |
| 100 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); | 100 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); |
| 101 scoped_ptr<Attachment> some_attachment = Attachment::Create(some_data); | 101 Attachment some_attachment = Attachment::Create(some_data); |
| 102 AttachmentId some_id = some_attachment->GetId(); | 102 AttachmentId some_id = some_attachment.GetId(); |
| 103 store.Read(some_id, read_callback); | 103 store.Read(some_id, read_callback); |
| 104 ClearAndPumpLoop(); | 104 ClearAndPumpLoop(); |
| 105 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 105 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
| 106 EXPECT_EQ(NULL, attachment.get()); | 106 EXPECT_EQ(NULL, attachment.get()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 TEST_F(FakeAttachmentStoreTest, Drop) { | 109 TEST_F(FakeAttachmentStoreTest, Drop) { |
| 110 FakeAttachmentStore store(base::MessageLoopProxy::current()); | 110 FakeAttachmentStore store(base::MessageLoopProxy::current()); |
| 111 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); | 111 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); |
| 112 some_data->data() = kTestData; | 112 some_data->data() = kTestData; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 128 store.Drop(id_written, drop_callback); | 128 store.Drop(id_written, drop_callback); |
| 129 ClearAndPumpLoop(); | 129 ClearAndPumpLoop(); |
| 130 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 130 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
| 131 | 131 |
| 132 store.Read(id_written, read_callback); | 132 store.Read(id_written, read_callback); |
| 133 ClearAndPumpLoop(); | 133 ClearAndPumpLoop(); |
| 134 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 134 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace syncer | 137 } // namespace syncer |
| OLD | NEW |