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

Side by Side Diff: chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // |device_descriptions| has been filled with the device descriptions 135 // |device_descriptions| has been filled with the device descriptions
136 // resulting from that call. 136 // resulting from that call.
137 void GetAudioDeviceDescriptions( 137 void GetAudioDeviceDescriptions(
138 void (AudioManager::*EnumerationFunc)(AudioDeviceDescriptions*), 138 void (AudioManager::*EnumerationFunc)(AudioDeviceDescriptions*),
139 AudioDeviceDescriptions* device_descriptions) { 139 AudioDeviceDescriptions* device_descriptions) {
140 AudioManager* audio_manager = AudioManager::Get(); 140 AudioManager* audio_manager = AudioManager::Get();
141 141
142 if (!audio_manager->GetTaskRunner()->BelongsToCurrentThread()) { 142 if (!audio_manager->GetTaskRunner()->BelongsToCurrentThread()) {
143 audio_manager->GetTaskRunner()->PostTask( 143 audio_manager->GetTaskRunner()->PostTask(
144 FROM_HERE, 144 FROM_HERE,
145 base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceDescriptions, 145 base::BindOnce(&WebrtcAudioPrivateTest::GetAudioDeviceDescriptions,
146 base::Unretained(this), EnumerationFunc, 146 base::Unretained(this), EnumerationFunc,
147 device_descriptions)); 147 device_descriptions));
148 enumeration_event_.Wait(); 148 enumeration_event_.Wait();
149 } else { 149 } else {
150 (audio_manager->*EnumerationFunc)(device_descriptions); 150 (audio_manager->*EnumerationFunc)(device_descriptions);
151 enumeration_event_.Signal(); 151 enumeration_event_.Signal();
152 } 152 }
153 } 153 }
154 154
155 // Synchronously (from the calling thread's point of view) retrieve the 155 // Synchronously (from the calling thread's point of view) retrieve the
156 // device id in the |origin| on the IO thread. On return, 156 // device id in the |origin| on the IO thread. On return,
157 // |id_in_origin| contains the id |raw_device_id| is known by in 157 // |id_in_origin| contains the id |raw_device_id| is known by in
158 // the origin. 158 // the origin.
159 void GetIDInOrigin(content::ResourceContext* resource_context, 159 void GetIDInOrigin(content::ResourceContext* resource_context,
160 GURL origin, 160 GURL origin,
161 const std::string& raw_device_id, 161 const std::string& raw_device_id,
162 std::string* id_in_origin) { 162 std::string* id_in_origin) {
163 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { 163 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
164 content::BrowserThread::PostTask( 164 content::BrowserThread::PostTask(
165 content::BrowserThread::UI, FROM_HERE, 165 content::BrowserThread::UI, FROM_HERE,
166 base::Bind(&WebrtcAudioPrivateTest::GetIDInOrigin, 166 base::BindOnce(&WebrtcAudioPrivateTest::GetIDInOrigin,
167 base::Unretained(this), 167 base::Unretained(this), resource_context, origin,
168 resource_context, origin, raw_device_id, id_in_origin)); 168 raw_device_id, id_in_origin));
169 enumeration_event_.Wait(); 169 enumeration_event_.Wait();
170 } else { 170 } else {
171 *id_in_origin = content::GetHMACForMediaDeviceID( 171 *id_in_origin = content::GetHMACForMediaDeviceID(
172 resource_context->GetMediaDeviceIDSalt(), url::Origin(origin), 172 resource_context->GetMediaDeviceIDSalt(), url::Origin(origin),
173 raw_device_id); 173 raw_device_id);
174 enumeration_event_.Signal(); 174 enumeration_event_.Signal();
175 } 175 }
176 } 176 }
177 177
178 // Event used to signal completion of enumeration. 178 // Event used to signal completion of enumeration.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); 429 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure"));
430 base::string16 result = title_watcher.WaitAndGetTitle(); 430 base::string16 result = title_watcher.WaitAndGetTitle();
431 EXPECT_EQ(base::ASCIIToUTF16("success"), result); 431 EXPECT_EQ(base::ASCIIToUTF16("success"), result);
432 432
433 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( 433 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting(
434 NULL); 434 NULL);
435 } 435 }
436 #endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION) 436 #endif // BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
437 437
438 } // namespace extensions 438 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698