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

Unified Diff: ppapi/tests/test_audio_config.cc

Issue 8742026: Pepper: Add a test for PPB_AudioConfig failure cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « ppapi/tests/test_audio_config.h ('k') | tools/valgrind/gtest_exclude/ui_tests.gtest_mac.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_audio_config.cc
diff --git a/ppapi/tests/test_audio_config.cc b/ppapi/tests/test_audio_config.cc
index bb3e630390f042decd077692248fa8226a89a969..650e31347ac928bcf32f81a0d6531ace4ff60e3c 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();
+}
« no previous file with comments | « ppapi/tests/test_audio_config.h ('k') | tools/valgrind/gtest_exclude/ui_tests.gtest_mac.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698