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

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

Issue 2031713002: Migrate WaitableEvent to enum-based constructor in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | sync/internal_api/http_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/internal_api/public/attachments/attachment_service_proxy.h" 5 #include "sync/internal_api/public/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/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 // a GetOrDownloadCallback 108 // a GetOrDownloadCallback
109 void IncrementGetOrDownload(const AttachmentService::GetOrDownloadResult&, 109 void IncrementGetOrDownload(const AttachmentService::GetOrDownloadResult&,
110 std::unique_ptr<AttachmentMap>) { 110 std::unique_ptr<AttachmentMap>) {
111 CalledOnValidThread(); 111 CalledOnValidThread();
112 ++count_callback_get_or_download; 112 ++count_callback_get_or_download;
113 } 113 }
114 114
115 void WaitForStubThread() { 115 void WaitForStubThread() {
116 base::WaitableEvent done(false, false); 116 base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
117 base::WaitableEvent::InitialState::NOT_SIGNALED);
117 stub_thread->message_loop()->PostTask( 118 stub_thread->message_loop()->PostTask(
118 FROM_HERE, 119 FROM_HERE,
119 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); 120 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
120 done.Wait(); 121 done.Wait();
121 } 122 }
122 123
123 base::MessageLoop loop; 124 base::MessageLoop loop;
124 std::unique_ptr<base::Thread> stub_thread; 125 std::unique_ptr<base::Thread> stub_thread;
125 std::unique_ptr<StubAttachmentService> stub; 126 std::unique_ptr<StubAttachmentService> stub;
126 std::unique_ptr<AttachmentServiceProxy> proxy; 127 std::unique_ptr<AttachmentServiceProxy> proxy;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Now that the wrapped object has been destroyed, call again and see that we 171 // Now that the wrapped object has been destroyed, call again and see that we
171 // don't crash and the count remains the same. 172 // don't crash and the count remains the same.
172 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download); 173 proxy->GetOrDownloadAttachments(AttachmentIdList(), callback_get_or_download);
173 WaitForStubThread(); 174 WaitForStubThread();
174 WaitForStubThread(); 175 WaitForStubThread();
175 base::RunLoop().RunUntilIdle(); 176 base::RunLoop().RunUntilIdle();
176 EXPECT_EQ(1, count_callback_get_or_download); 177 EXPECT_EQ(1, count_callback_get_or_download);
177 } 178 }
178 179
179 } // namespace syncer 180 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/http_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698