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_service_proxy.h" | 5 #include "components/sync/core/attachments/attachment_service_proxy.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "sync/api/attachments/attachment.h" | 19 #include "components/sync/api/attachments/attachment.h" |
20 #include "sync/internal_api/public/attachments/attachment_service.h" | 20 #include "components/sync/base/model_type.h" |
21 #include "sync/internal_api/public/base/model_type.h" | 21 #include "components/sync/core/attachments/attachment_service.h" |
22 #include "sync/protocol/sync.pb.h" | 22 #include "components/sync/protocol/sync.pb.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 namespace syncer { | 25 namespace syncer { |
26 | 26 |
27 // A stub implementation of AttachmentService that counts the number of times | 27 // A stub implementation of AttachmentService that counts the number of times |
28 // its methods are invoked. | 28 // its methods are invoked. |
29 class StubAttachmentService : public AttachmentService, | 29 class StubAttachmentService : public AttachmentService, |
30 public base::NonThreadSafe { | 30 public base::NonThreadSafe { |
31 public: | 31 public: |
32 StubAttachmentService() : call_count_(0), weak_ptr_factory_(this) { | 32 StubAttachmentService() : call_count_(0), weak_ptr_factory_(this) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Now that the wrapped object has been destroyed, call again and see that we | 173 // Now that the wrapped object has been destroyed, call again and see that we |
174 // don't crash and the count remains the same. | 174 // don't crash and the count remains the same. |
175 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download); | 175 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download); |
176 WaitForStubThread(); | 176 WaitForStubThread(); |
177 WaitForStubThread(); | 177 WaitForStubThread(); |
178 base::RunLoop().RunUntilIdle(); | 178 base::RunLoop().RunUntilIdle(); |
179 EXPECT_EQ(1, count_callback_get_or_download); | 179 EXPECT_EQ(1, count_callback_get_or_download); |
180 } | 180 } |
181 | 181 |
182 } // namespace syncer | 182 } // namespace syncer |
OLD | NEW |