summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_audio_config.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 00:40:52 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 00:40:52 +0000
commitc3d0621bd32f320636e4498010c9ce45827a45c9 (patch)
tree0e9ea626da883234e28e32ad18392755ebadb9c3 /ppapi/tests/test_audio_config.cc
parent5e143e8e6254e345cf151abd3c4a7702c6ac20be (diff)
downloadchromium_src-c3d0621bd32f320636e4498010c9ce45827a45c9.zip
chromium_src-c3d0621bd32f320636e4498010c9ce45827a45c9.tar.gz
chromium_src-c3d0621bd32f320636e4498010c9ce45827a45c9.tar.bz2
Pepper: Add a test for PPB_AudioConfig failure cases.
Also rename "Everything" to "ValidConfigs" and update the (Mac) Valgrind exclusion. And preemptively add an exclusion for the new test. :( Review URL: http://codereview.chromium.org/8742026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/test_audio_config.cc')
-rw-r--r--ppapi/tests/test_audio_config.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/ppapi/tests/test_audio_config.cc b/ppapi/tests/test_audio_config.cc
index bb3e630..650e313 100644
--- a/ppapi/tests/test_audio_config.cc
+++ b/ppapi/tests/test_audio_config.cc
@@ -20,10 +20,11 @@ bool TestAudioConfig::Init() {
}
void TestAudioConfig::RunTests(const std::string& filter) {
- RUN_TEST(Everything, filter);
+ RUN_TEST(ValidConfigs, filter);
+ RUN_TEST(InvalidConfigs, filter);
}
-std::string TestAudioConfig::TestEverything() {
+std::string TestAudioConfig::TestValidConfigs() {
static const PP_AudioSampleRate kSampleRates[] = {
PP_AUDIOSAMPLERATE_44100,
PP_AUDIOSAMPLERATE_48000
@@ -63,3 +64,32 @@ std::string TestAudioConfig::TestEverything() {
PASS();
}
+
+std::string TestAudioConfig::TestInvalidConfigs() {
+ // |PP_AUDIOSAMPLERATE_NONE| is not a valid rate, so this should fail.
+ PP_Resource ac = audio_config_interface_->CreateStereo16Bit(
+ instance_->pp_instance(),
+ PP_AUDIOSAMPLERATE_NONE,
+ PP_AUDIOMINSAMPLEFRAMECOUNT);
+ ASSERT_EQ(0, ac);
+
+ // Test invalid frame counts.
+ ASSERT_TRUE(PP_AUDIOMINSAMPLEFRAMECOUNT >= 1);
+ ac = audio_config_interface_->CreateStereo16Bit(
+ instance_->pp_instance(),
+ PP_AUDIOSAMPLERATE_44100,
+ PP_AUDIOMINSAMPLEFRAMECOUNT - 1u);
+ ASSERT_EQ(0, ac);
+ ac = audio_config_interface_->CreateStereo16Bit(
+ instance_->pp_instance(),
+ PP_AUDIOSAMPLERATE_44100,
+ PP_AUDIOMAXSAMPLEFRAMECOUNT + 1u);
+ ASSERT_EQ(0, ac);
+
+ // Test rest of API whose failure cases are defined.
+ ASSERT_FALSE(audio_config_interface_->IsAudioConfig(0));
+ ASSERT_EQ(PP_AUDIOSAMPLERATE_NONE, audio_config_interface_->GetSampleRate(0));
+ ASSERT_EQ(0u, audio_config_interface_->GetSampleFrameCount(0));
+
+ PASS();
+}