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

Side by Side Diff: webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm

Issue 2872953002: iOS audio session isInterrupted flag does not get reset correctly: (Closed)
Patch Set: Errant dot Created 3 years, 7 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 | « webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc ('k') | 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 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 14 matching lines...) Expand all
25 #include "webrtc/modules/audio_device/audio_device_impl.h" 25 #include "webrtc/modules/audio_device/audio_device_impl.h"
26 #include "webrtc/modules/audio_device/include/audio_device.h" 26 #include "webrtc/modules/audio_device/include/audio_device.h"
27 #include "webrtc/modules/audio_device/include/mock_audio_transport.h" 27 #include "webrtc/modules/audio_device/include/mock_audio_transport.h"
28 #include "webrtc/modules/audio_device/ios/audio_device_ios.h" 28 #include "webrtc/modules/audio_device/ios/audio_device_ios.h"
29 #include "webrtc/system_wrappers/include/event_wrapper.h" 29 #include "webrtc/system_wrappers/include/event_wrapper.h"
30 #include "webrtc/system_wrappers/include/sleep.h" 30 #include "webrtc/system_wrappers/include/sleep.h"
31 #include "webrtc/test/gmock.h" 31 #include "webrtc/test/gmock.h"
32 #include "webrtc/test/gtest.h" 32 #include "webrtc/test/gtest.h"
33 #include "webrtc/test/testsupport/fileutils.h" 33 #include "webrtc/test/testsupport/fileutils.h"
34 34
35 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h"
36 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession+Private.h"
37
35 using std::cout; 38 using std::cout;
36 using std::endl; 39 using std::endl;
37 using ::testing::_; 40 using ::testing::_;
38 using ::testing::AtLeast; 41 using ::testing::AtLeast;
39 using ::testing::Gt; 42 using ::testing::Gt;
40 using ::testing::Invoke; 43 using ::testing::Invoke;
41 using ::testing::NiceMock; 44 using ::testing::NiceMock;
42 using ::testing::NotNull; 45 using ::testing::NotNull;
43 using ::testing::Return; 46 using ::testing::Return;
44 47
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 std::max(kTestTimeOutInMilliseconds, 1000 * kMeasureLatencyTimeInSec)); 818 std::max(kTestTimeOutInMilliseconds, 1000 * kMeasureLatencyTimeInSec));
816 StopPlayout(); 819 StopPlayout();
817 StopRecording(); 820 StopRecording();
818 // Verify that the correct number of transmitted impulses are detected. 821 // Verify that the correct number of transmitted impulses are detected.
819 EXPECT_EQ(latency_audio_stream->num_latency_values(), 822 EXPECT_EQ(latency_audio_stream->num_latency_values(),
820 static_cast<size_t>( 823 static_cast<size_t>(
821 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1)); 824 kImpulseFrequencyInHz * kMeasureLatencyTimeInSec - 1));
822 latency_audio_stream->PrintResults(); 825 latency_audio_stream->PrintResults();
823 } 826 }
824 827
828 TEST_F(AudioDeviceTest, testInterruptedAudioSession) {
henrika_webrtc 2017/05/10 14:08:19 Care to add some comments above this test to expla
829 RTCAudioSession *session = [RTCAudioSession sharedInstance];
830 std::unique_ptr<webrtc::AudioDeviceIOS> audio_device;
831 audio_device.reset(new webrtc::AudioDeviceIOS());
832 std::unique_ptr<webrtc::AudioDeviceBuffer> audio_buffer;
833 audio_buffer.reset(new webrtc::AudioDeviceBuffer());
834 audio_device->AttachAudioBuffer(audio_buffer.get());
835 audio_device->Init();
836 audio_device->InitPlayout();
837 // Force interruption.
838 [session notifyDidBeginInterruption];
839
840 // Wait for notification to propagate.
841 rtc::MessageQueueManager::ProcessAllMessageQueues();
842 EXPECT_TRUE(audio_device->is_interrupted_);
843
844 // Force it for testing.
845 audio_device->playing_ = false;
846 audio_device->ShutdownPlayOrRecord();
847 // Force it for testing.
848 audio_device->audio_is_initialized_ = false;
849
850 [session notifyDidEndInterruptionWithShouldResumeSession:YES];
851 // Wait for notification to propagate.
852 rtc::MessageQueueManager::ProcessAllMessageQueues();
853 EXPECT_TRUE(audio_device->is_interrupted_);
854
855 audio_device->Init();
856 audio_device->InitPlayout();
857 EXPECT_FALSE(audio_device->is_interrupted_);
858 }
859
825 } // namespace webrtc 860 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698