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

Unified Diff: webrtc/audio/utility/audio_frame_operations_unittest.cc

Issue 2424173003: Move functionality out from AudioFrame and into AudioFrameOperations. (Closed)
Patch Set: Include order & DCHECKs. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/audio/utility/audio_frame_operations.cc ('k') | webrtc/modules/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/audio/utility/audio_frame_operations_unittest.cc
diff --git a/webrtc/modules/utility/source/audio_frame_operations_unittest.cc b/webrtc/audio/utility/audio_frame_operations_unittest.cc
similarity index 93%
rename from webrtc/modules/utility/source/audio_frame_operations_unittest.cc
rename to webrtc/audio/utility/audio_frame_operations_unittest.cc
index 8f83e051ee19ffc8af6f8533532bc4c926be1f2b..36377bd02d8e0db830e7a8353521703908cfc5d1 100644
--- a/webrtc/modules/utility/source/audio_frame_operations_unittest.cc
+++ b/webrtc/audio/utility/audio_frame_operations_unittest.cc
@@ -8,9 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/base/checks.h"
#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/modules/utility/include/audio_frame_operations.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
@@ -365,5 +365,25 @@ TEST_F(AudioFrameOperationsTest, ScaleWithSatSucceeds) {
VerifyFramesAreEqual(scaled_frame, frame_);
}
+TEST_F(AudioFrameOperationsTest, AddingXToEmptyGivesX) {
+ // When samples_per_channel_ is 0, the frame counts as empty and zero.
+ AudioFrame frame_to_add_to;
+ frame_to_add_to.samples_per_channel_ = 0;
+ frame_to_add_to.num_channels_ = frame_.num_channels_;
+
+ AudioFrameOperations::Add(frame_, &frame_to_add_to);
+ VerifyFramesAreEqual(frame_, frame_to_add_to);
+}
+
+TEST_F(AudioFrameOperationsTest, AddingTwoFramesProducesTheirSum) {
+ AudioFrame frame_to_add_to;
+ frame_to_add_to.samples_per_channel_ = frame_.samples_per_channel_;
+ frame_to_add_to.num_channels_ = frame_.num_channels_;
+ SetFrameData(&frame_to_add_to, 1000);
+
+ AudioFrameOperations::Add(frame_, &frame_to_add_to);
+ SetFrameData(&frame_, frame_.data_[0] + 1000);
+ VerifyFramesAreEqual(frame_, frame_to_add_to);
+}
} // namespace
} // namespace webrtc
« no previous file with comments | « webrtc/audio/utility/audio_frame_operations.cc ('k') | webrtc/modules/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698