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/fake_attachment_uploader.h" | 5 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 ++(*success_count); | 40 ++(*success_count); |
41 } | 41 } |
42 } | 42 } |
43 }; | 43 }; |
44 | 44 |
45 // Call upload attachment several times, see that the supplied callback is | 45 // Call upload attachment several times, see that the supplied callback is |
46 // invoked the same number of times with a result of SUCCESS. | 46 // invoked the same number of times with a result of SUCCESS. |
47 TEST_F(FakeAttachmentUploaderTest, UploadAttachment) { | 47 TEST_F(FakeAttachmentUploaderTest, UploadAttachment) { |
48 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); | 48 scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString); |
49 some_data->data() = kAttachmentData; | 49 some_data->data() = kAttachmentData; |
50 Attachment attachment1 = Attachment::Create(some_data); | 50 Attachment attachment1 = Attachment::CreateNew(some_data); |
51 Attachment attachment2 = Attachment::Create(some_data); | 51 Attachment attachment2 = Attachment::CreateNew(some_data); |
52 Attachment attachment3 = Attachment::Create(some_data); | 52 Attachment attachment3 = Attachment::CreateNew(some_data); |
53 uploader.UploadAttachment(attachment1, upload_callback); | 53 uploader.UploadAttachment(attachment1, upload_callback); |
54 uploader.UploadAttachment(attachment2, upload_callback); | 54 uploader.UploadAttachment(attachment2, upload_callback); |
55 uploader.UploadAttachment(attachment3, upload_callback); | 55 uploader.UploadAttachment(attachment3, upload_callback); |
56 message_loop.RunUntilIdle(); | 56 message_loop.RunUntilIdle(); |
57 EXPECT_EQ(upload_callback_count, 3); | 57 EXPECT_EQ(upload_callback_count, 3); |
58 } | 58 } |
59 | 59 |
60 } // namespace syncer | 60 } // namespace syncer |
OLD | NEW |