Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / content / renderer / media / webrtc / webrtc_local_audio_track_adapter_unittest.cc
index fd711c5..9a827ee 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/command_line.h"
+#include "content/public/common/content_switches.h"
 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
 #include "content/renderer/media/webrtc_local_audio_track.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -41,8 +43,6 @@ class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test {
 
  protected:
   virtual void SetUp() OVERRIDE {
-    static_cast<WebRtcLocalAudioSourceProvider*>(
-        track_->audio_source_provider())->SetSinkParamsForTesting(params_);
     track_->OnSetFormat(params_);
     EXPECT_TRUE(track_->GetAudioAdapter()->enabled());
   }
@@ -81,4 +81,16 @@ TEST_F(WebRtcLocalAudioTrackAdapterTest, AddAndRemoveSink) {
   track_->Capture(data.get(), base::TimeDelta(), 255, false, false);
 }
 
+TEST_F(WebRtcLocalAudioTrackAdapterTest, GetSignalLevel) {
+  webrtc::AudioTrackInterface* webrtc_track =
+      static_cast<webrtc::AudioTrackInterface*>(adapter_.get());
+  int signal_level = 0;
+  EXPECT_FALSE(webrtc_track->GetSignalLevel(&signal_level));
+
+  // Enable the audio processing in the audio track.
+  CommandLine::ForCurrentProcess()->AppendSwitch(
+      switches::kEnableAudioTrackProcessing);
+  EXPECT_TRUE(webrtc_track->GetSignalLevel(&signal_level));
+}
+
 }  // namespace content