Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: sync/api/attachments/attachment_service_proxy_unittest.cc

Issue 213003004: Replace calls to 3-arg SyncData::CreateLocalData with 5-arg version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Forgot a class keyword. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/attachment_service_proxy.h" 5 #include "sync/api/attachments/attachment_service_proxy.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 class AttachmentServiceProxyTest : public testing::Test, 97 class AttachmentServiceProxyTest : public testing::Test,
98 public base::NonThreadSafe { 98 public base::NonThreadSafe {
99 protected: 99 protected:
100 AttachmentServiceProxyTest() {} 100 AttachmentServiceProxyTest() {}
101 101
102 virtual void SetUp() { 102 virtual void SetUp() {
103 CalledOnValidThread(); 103 CalledOnValidThread();
104 stub_thread.reset(new base::Thread("attachment service stub thread")); 104 stub_thread.reset(new base::Thread("attachment service stub thread"));
105 stub_thread->Start(); 105 stub_thread->Start();
106 stub.reset(new StubAttachmentService); 106 stub.reset(new StubAttachmentService);
107 proxy.reset(new AttachmentServiceProxy(stub_thread->message_loop_proxy(), 107 proxy = new AttachmentServiceProxy(stub_thread->message_loop_proxy(),
108 stub->AsWeakPtr())); 108 stub->AsWeakPtr());
109 109
110 sync_data = 110 sync_data =
111 SyncData::CreateLocalData("tag", "title", sync_pb::EntitySpecifics()); 111 SyncData::CreateLocalData("tag", "title", sync_pb::EntitySpecifics());
112 sync_data_delete = 112 sync_data_delete =
113 SyncData::CreateLocalDelete("tag", syncer::PREFERENCES); 113 SyncData::CreateLocalDelete("tag", syncer::PREFERENCES);
114 114
115 callback_get_or_download = 115 callback_get_or_download =
116 base::Bind(&AttachmentServiceProxyTest::IncrementGetOrDownload, 116 base::Bind(&AttachmentServiceProxyTest::IncrementGetOrDownload,
117 base::Unretained(this)); 117 base::Unretained(this));
118 callback_drop = base::Bind(&AttachmentServiceProxyTest::IncrementDrop, 118 callback_drop = base::Bind(&AttachmentServiceProxyTest::IncrementDrop,
(...skipping 30 matching lines...) Expand all
149 base::WaitableEvent done(false, false); 149 base::WaitableEvent done(false, false);
150 stub_thread->message_loop()->PostTask( 150 stub_thread->message_loop()->PostTask(
151 FROM_HERE, 151 FROM_HERE,
152 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); 152 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
153 done.Wait(); 153 done.Wait();
154 } 154 }
155 155
156 base::MessageLoop loop; 156 base::MessageLoop loop;
157 scoped_ptr<base::Thread> stub_thread; 157 scoped_ptr<base::Thread> stub_thread;
158 scoped_ptr<StubAttachmentService> stub; 158 scoped_ptr<StubAttachmentService> stub;
159 scoped_ptr<AttachmentServiceProxy> proxy; 159 scoped_refptr<AttachmentServiceProxy> proxy;
160 160
161 SyncData sync_data; 161 SyncData sync_data;
162 SyncData sync_data_delete; 162 SyncData sync_data_delete;
163 163
164 AttachmentService::GetOrDownloadCallback callback_get_or_download; 164 AttachmentService::GetOrDownloadCallback callback_get_or_download;
165 AttachmentService::DropCallback callback_drop; 165 AttachmentService::DropCallback callback_drop;
166 166
167 // number of times callback_get_or_download was invoked 167 // number of times callback_get_or_download was invoked
168 int count_callback_get_or_download; 168 int count_callback_get_or_download;
169 // number of times callback_drop was invoked 169 // number of times callback_drop was invoked
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Now that the wrapped object has been destroyed, call again and see that we 220 // Now that the wrapped object has been destroyed, call again and see that we
221 // don't crash and the count remains the same. 221 // don't crash and the count remains the same.
222 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download); 222 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download);
223 WaitForStubThread(); 223 WaitForStubThread();
224 WaitForStubThread(); 224 WaitForStubThread();
225 loop.RunUntilIdle(); 225 loop.RunUntilIdle();
226 EXPECT_EQ(1, count_callback_get_or_download); 226 EXPECT_EQ(1, count_callback_get_or_download);
227 } 227 }
228 228
229 } // namespace syncer 229 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698