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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 store.Read(id_written, read_callback); | 93 store.Read(id_written, read_callback); |
94 ClearAndPumpLoop(); | 94 ClearAndPumpLoop(); |
95 EXPECT_EQ(result, AttachmentStore::SUCCESS); | 95 EXPECT_EQ(result, AttachmentStore::SUCCESS); |
96 EXPECT_EQ(id_written.unique_id(), attachment->GetId().unique_id()); | 96 EXPECT_EQ(id_written.unique_id(), attachment->GetId().unique_id()); |
97 EXPECT_EQ(some_data, attachment->GetData()); | 97 EXPECT_EQ(some_data, attachment->GetData()); |
98 } | 98 } |
99 | 99 |
100 TEST_F(FakeAttachmentStoreTest, Read_NotFound) { | 100 TEST_F(FakeAttachmentStoreTest, Read_NotFound) { |
101 FakeAttachmentStore store(base::MessageLoopProxy::current()); | 101 FakeAttachmentStore store(base::MessageLoopProxy::current()); |
102 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); | 102 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); |
103 scoped_ptr<Attachment> some_attachment = Attachment::Create(some_data); | 103 Attachment some_attachment = Attachment::Create(some_data); |
104 AttachmentId some_id = some_attachment->GetId(); | 104 AttachmentId some_id = some_attachment.GetId(); |
105 store.Read(some_id, read_callback); | 105 store.Read(some_id, read_callback); |
106 ClearAndPumpLoop(); | 106 ClearAndPumpLoop(); |
107 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 107 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
108 EXPECT_EQ(NULL, attachment.get()); | 108 EXPECT_EQ(NULL, attachment.get()); |
109 } | 109 } |
110 | 110 |
111 TEST_F(FakeAttachmentStoreTest, Drop) { | 111 TEST_F(FakeAttachmentStoreTest, Drop) { |
112 FakeAttachmentStore store(base::MessageLoopProxy::current()); | 112 FakeAttachmentStore store(base::MessageLoopProxy::current()); |
113 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); | 113 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); |
114 some_data->data() = kTestData; | 114 some_data->data() = kTestData; |
(...skipping 16 matching lines...) Expand all Loading... |
131 store.Drop(id_written, drop_callback); | 131 store.Drop(id_written, drop_callback); |
132 ClearAndPumpLoop(); | 132 ClearAndPumpLoop(); |
133 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 133 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
134 | 134 |
135 store.Read(id_written, read_callback); | 135 store.Read(id_written, read_callback); |
136 ClearAndPumpLoop(); | 136 ClearAndPumpLoop(); |
137 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); | 137 EXPECT_EQ(result, AttachmentStore::NOT_FOUND); |
138 } | 138 } |
139 | 139 |
140 } // namespace syncer | 140 } // namespace syncer |
OLD | NEW |