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_downloader.h" | 5 #include "components/sync/core/attachments/fake_attachment_downloader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "sync/api/attachments/attachment.h" | 12 #include "components/sync/api/attachments/attachment.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace syncer { | 15 namespace syncer { |
16 | 16 |
17 class FakeAttachmentDownloaderTest : public testing::Test { | 17 class FakeAttachmentDownloaderTest : public testing::Test { |
18 protected: | 18 protected: |
19 FakeAttachmentDownloaderTest() {} | 19 FakeAttachmentDownloaderTest() {} |
20 | 20 |
21 void SetUp() override {} | 21 void SetUp() override {} |
22 | 22 |
23 void TearDown() override {} | 23 void TearDown() override {} |
24 | 24 |
25 AttachmentDownloader* downloader() { | 25 AttachmentDownloader* downloader() { return &attachment_downloader_; } |
26 return &attachment_downloader_; | |
27 } | |
28 | 26 |
29 AttachmentDownloader::DownloadCallback download_callback() { | 27 AttachmentDownloader::DownloadCallback download_callback() { |
30 return base::Bind(&FakeAttachmentDownloaderTest::DownloadDone, | 28 return base::Bind(&FakeAttachmentDownloaderTest::DownloadDone, |
31 base::Unretained(this)); | 29 base::Unretained(this)); |
32 } | 30 } |
33 | 31 |
34 const std::vector<AttachmentDownloader::DownloadResult>& download_results() { | 32 const std::vector<AttachmentDownloader::DownloadResult>& download_results() { |
35 return download_results_; | 33 return download_results_; |
36 } | 34 } |
37 | 35 |
(...skipping 15 matching lines...) Expand all Loading... |
53 | 51 |
54 TEST_F(FakeAttachmentDownloaderTest, DownloadAttachment) { | 52 TEST_F(FakeAttachmentDownloaderTest, DownloadAttachment) { |
55 AttachmentId attachment_id = AttachmentId::Create(0, 0); | 53 AttachmentId attachment_id = AttachmentId::Create(0, 0); |
56 downloader()->DownloadAttachment(attachment_id, download_callback()); | 54 downloader()->DownloadAttachment(attachment_id, download_callback()); |
57 RunMessageLoop(); | 55 RunMessageLoop(); |
58 EXPECT_EQ(1U, download_results().size()); | 56 EXPECT_EQ(1U, download_results().size()); |
59 EXPECT_EQ(AttachmentDownloader::DOWNLOAD_SUCCESS, download_results()[0]); | 57 EXPECT_EQ(AttachmentDownloader::DOWNLOAD_SUCCESS, download_results()[0]); |
60 } | 58 } |
61 | 59 |
62 } // namespace syncer | 60 } // namespace syncer |
OLD | NEW |