OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/tests/test_audio_config.h" | 5 #include "ppapi/tests/test_audio_config.h" |
6 | 6 |
7 #include "ppapi/c/ppb_audio_config.h" | 7 #include "ppapi/c/ppb_audio_config.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/tests/testing_instance.h" | 9 #include "ppapi/tests/testing_instance.h" |
10 | 10 |
11 REGISTER_TEST_CASE(AudioConfig); | 11 REGISTER_TEST_CASE(AudioConfig); |
(...skipping 29 matching lines...) Expand all Loading... |
41 PP_AudioSampleRate sample_rate = kSampleRates[i]; | 41 PP_AudioSampleRate sample_rate = kSampleRates[i]; |
42 | 42 |
43 for (size_t j = 0; | 43 for (size_t j = 0; |
44 j < sizeof(kRequestFrameCounts)/sizeof(kRequestFrameCounts); | 44 j < sizeof(kRequestFrameCounts)/sizeof(kRequestFrameCounts); |
45 j++) { | 45 j++) { |
46 uint32_t request_frame_count = kRequestFrameCounts[j]; | 46 uint32_t request_frame_count = kRequestFrameCounts[j]; |
47 ASSERT_TRUE(request_frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); | 47 ASSERT_TRUE(request_frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); |
48 ASSERT_TRUE(request_frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); | 48 ASSERT_TRUE(request_frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); |
49 | 49 |
50 uint32_t frame_count = audio_config_interface_->RecommendSampleFrameCount( | 50 uint32_t frame_count = audio_config_interface_->RecommendSampleFrameCount( |
51 sample_rate, request_frame_count); | 51 instance_->pp_instance(), sample_rate, request_frame_count); |
52 ASSERT_TRUE(frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); | 52 ASSERT_TRUE(frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); |
53 ASSERT_TRUE(frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); | 53 ASSERT_TRUE(frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); |
54 | 54 |
55 PP_Resource ac = audio_config_interface_->CreateStereo16Bit( | 55 PP_Resource ac = audio_config_interface_->CreateStereo16Bit( |
56 instance_->pp_instance(), sample_rate, frame_count); | 56 instance_->pp_instance(), sample_rate, frame_count); |
57 ASSERT_TRUE(ac); | 57 ASSERT_TRUE(ac); |
58 ASSERT_TRUE(audio_config_interface_->IsAudioConfig(ac)); | 58 ASSERT_TRUE(audio_config_interface_->IsAudioConfig(ac)); |
59 ASSERT_EQ(sample_rate, audio_config_interface_->GetSampleRate(ac)); | 59 ASSERT_EQ(sample_rate, audio_config_interface_->GetSampleRate(ac)); |
60 ASSERT_EQ(frame_count, audio_config_interface_->GetSampleFrameCount(ac)); | 60 ASSERT_EQ(frame_count, audio_config_interface_->GetSampleFrameCount(ac)); |
61 | 61 |
(...skipping 25 matching lines...) Expand all Loading... |
87 PP_AUDIOMAXSAMPLEFRAMECOUNT + 1u); | 87 PP_AUDIOMAXSAMPLEFRAMECOUNT + 1u); |
88 ASSERT_EQ(0, ac); | 88 ASSERT_EQ(0, ac); |
89 | 89 |
90 // Test rest of API whose failure cases are defined. | 90 // Test rest of API whose failure cases are defined. |
91 ASSERT_FALSE(audio_config_interface_->IsAudioConfig(0)); | 91 ASSERT_FALSE(audio_config_interface_->IsAudioConfig(0)); |
92 ASSERT_EQ(PP_AUDIOSAMPLERATE_NONE, audio_config_interface_->GetSampleRate(0)); | 92 ASSERT_EQ(PP_AUDIOSAMPLERATE_NONE, audio_config_interface_->GetSampleRate(0)); |
93 ASSERT_EQ(0u, audio_config_interface_->GetSampleFrameCount(0)); | 93 ASSERT_EQ(0u, audio_config_interface_->GetSampleFrameCount(0)); |
94 | 94 |
95 PASS(); | 95 PASS(); |
96 } | 96 } |
OLD | NEW |