| OLD | NEW |
| 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 <vector> |
| 6 |
| 5 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 6 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
| 9 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 11 #include "content/public/common/media_stream_request.h" | 13 #include "content/public/common/media_stream_request.h" |
| 12 #include "content/renderer/media/media_stream_audio_processor.h" | 14 #include "content/renderer/media/media_stream_audio_processor.h" |
| 13 #include "content/renderer/media/media_stream_audio_processor_options.h" | 15 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 14 #include "content/renderer/media/mock_media_constraint_factory.h" | 16 #include "content/renderer/media/mock_media_constraint_factory.h" |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 520 |
| 519 ProcessDataAndVerifyFormat(audio_processor.get(), | 521 ProcessDataAndVerifyFormat(audio_processor.get(), |
| 520 kAudioProcessingSampleRate, | 522 kAudioProcessingSampleRate, |
| 521 kAudioProcessingNumberOfChannel, | 523 kAudioProcessingNumberOfChannel, |
| 522 kAudioProcessingSampleRate / 100); | 524 kAudioProcessingSampleRate / 100); |
| 523 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives | 525 // Set |audio_processor| to NULL to make sure |webrtc_audio_device| outlives |
| 524 // |audio_processor|. | 526 // |audio_processor|. |
| 525 audio_processor = NULL; | 527 audio_processor = NULL; |
| 526 } | 528 } |
| 527 | 529 |
| 530 using Point = webrtc::Point; |
| 531 using PointVector = std::vector<Point>; |
| 532 |
| 533 void ExpectPointVectorEqual(const PointVector& expected, |
| 534 const PointVector& actual) { |
| 535 EXPECT_EQ(expected.size(), actual.size()); |
| 536 for (size_t i = 0; i < actual.size(); ++i) { |
| 537 EXPECT_EQ(expected[i].x(), actual[i].x()); |
| 538 EXPECT_EQ(expected[i].y(), actual[i].y()); |
| 539 EXPECT_EQ(expected[i].z(), actual[i].z()); |
| 540 } |
| 541 } |
| 542 |
| 543 TEST(MediaStreamAudioProcessorOptionsTest, ParseArrayGeometry) { |
| 544 const PointVector expected_empty; |
| 545 ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("")); |
| 546 ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("0 0 a")); |
| 547 ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("1 2")); |
| 548 ExpectPointVectorEqual(expected_empty, ParseArrayGeometry("1 2 3 4")); |
| 549 |
| 550 { |
| 551 PointVector expected(1, Point(-0.02f, 0, 0)); |
| 552 expected.push_back(Point(0.02f, 0, 0)); |
| 553 ExpectPointVectorEqual(expected, ParseArrayGeometry("-0.02 0 0 0.02 0 0")); |
| 554 } |
| 555 { |
| 556 PointVector expected(1, Point(1, 2, 3)); |
| 557 ExpectPointVectorEqual(expected, ParseArrayGeometry("1 2 3")); |
| 558 } |
| 559 } |
| 560 |
| 528 } // namespace content | 561 } // namespace content |
| OLD | NEW |