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

Side by Side Diff: content/renderer/media/media_stream_constraints_util_audio_unittest.cc

Issue 2960973002: Work around dllimport member function pointer bug in clang (Closed)
Patch Set: remove whitespace change Created 3 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "content/renderer/media/media_stream_constraints_util_audio.h" 5 #include "content/renderer/media/media_stream_constraints_util_audio.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // All settings should have default values. 319 // All settings should have default values.
320 EXPECT_TRUE(result.HasValue()); 320 EXPECT_TRUE(result.HasValue());
321 CheckAllDefaults(AudioSettingsBoolMembers(), AudioPropertiesBoolMembers(), 321 CheckAllDefaults(AudioSettingsBoolMembers(), AudioPropertiesBoolMembers(),
322 result); 322 result);
323 } 323 }
324 324
325 // This test checks all possible ways to set boolean constraints (except 325 // This test checks all possible ways to set boolean constraints (except
326 // echo cancellation constraints, which are not mapped 1:1 to output audio 326 // echo cancellation constraints, which are not mapped 1:1 to output audio
327 // processing properties). 327 // processing properties).
328 TEST_P(MediaStreamConstraintsUtilAudioTest, SingleBoolConstraint) { 328 TEST_P(MediaStreamConstraintsUtilAudioTest, SingleBoolConstraint) {
329 const AudioSettingsBoolMembers kMainSettings = { 329 // TODO(crbug.com/736309): Use braced initialization instead of push_back once
330 &AudioCaptureSettings::hotword_enabled, 330 // clang has been fixed.
331 &AudioCaptureSettings::disable_local_echo, 331 AudioSettingsBoolMembers kMainSettings;
332 &AudioCaptureSettings::render_to_associated_sink}; 332 kMainSettings.push_back(&AudioCaptureSettings::hotword_enabled);
333 kMainSettings.push_back(&AudioCaptureSettings::disable_local_echo);
334 kMainSettings.push_back(&AudioCaptureSettings::render_to_associated_sink);
333 335
334 const std::vector< 336 const std::vector<
335 blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*> 337 blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*>
336 kMainBoolConstraints = { 338 kMainBoolConstraints = {
337 &blink::WebMediaTrackConstraintSet::hotword_enabled, 339 &blink::WebMediaTrackConstraintSet::hotword_enabled,
338 &blink::WebMediaTrackConstraintSet::disable_local_echo, 340 &blink::WebMediaTrackConstraintSet::disable_local_echo,
339 &blink::WebMediaTrackConstraintSet::render_to_associated_sink}; 341 &blink::WebMediaTrackConstraintSet::render_to_associated_sink};
340 342
341 ASSERT_EQ(kMainSettings.size(), kMainBoolConstraints.size()); 343 ASSERT_EQ(kMainSettings.size(), kMainBoolConstraints.size());
342 for (auto set_function : kBoolSetFunctions) { 344 for (auto set_function : kBoolSetFunctions) {
343 for (auto accessor : kFactoryAccessors) { 345 for (auto accessor : kFactoryAccessors) {
344 // Ideal advanced is ignored by the SelectSettings algorithm. 346 // Ideal advanced is ignored by the SelectSettings algorithm.
345 // Using array elements instead of pointer values due to the comparison 347 // Using array elements instead of pointer values due to the comparison
346 // failing on some build configurations. 348 // failing on some build configurations.
Nico 2017/06/28 13:16:11 Did you mean to revert this to the lhs of https://
347 if (set_function == kBoolSetFunctions[1] && 349 if (set_function == kBoolSetFunctions[1] &&
348 accessor == kFactoryAccessors[1]) { 350 accessor == kFactoryAccessors[1]) {
349 continue; 351 continue;
350 } 352 }
351 for (size_t i = 0; i < kMainSettings.size(); ++i) { 353 for (size_t i = 0; i < kMainSettings.size(); ++i) {
352 for (bool value : kBoolValues) { 354 for (bool value : kBoolValues) {
353 ResetFactory(); 355 ResetFactory();
354 (((constraint_factory_.*accessor)().*kMainBoolConstraints[i]).* 356 (((constraint_factory_.*accessor)().*kMainBoolConstraints[i]).*
355 set_function)(value); 357 set_function)(value);
356 auto result = SelectSettings(); 358 auto result = SelectSettings();
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 } 968 }
967 969
968 INSTANTIATE_TEST_CASE_P(, 970 INSTANTIATE_TEST_CASE_P(,
969 MediaStreamConstraintsUtilAudioTest, 971 MediaStreamConstraintsUtilAudioTest,
970 testing::Values("", 972 testing::Values("",
971 kMediaStreamSourceTab, 973 kMediaStreamSourceTab,
972 kMediaStreamSourceSystem, 974 kMediaStreamSourceSystem,
973 kMediaStreamSourceDesktop)); 975 kMediaStreamSourceDesktop));
974 976
975 } // namespace content 977 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698