| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "ppapi/tests/test_audio.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "ppapi/c/ppb_audio_config.h" | 9 #include "ppapi/c/ppb_audio_config.h" |
| 10 #include "ppapi/c/ppb_audio.h" | 10 #include "ppapi/c/ppb_audio.h" |
| 11 #include "ppapi/cpp/module.h" | 11 #include "ppapi/cpp/module.h" |
| 12 #include "ppapi/tests/testing_instance.h" | 12 #include "ppapi/tests/testing_instance.h" |
| 13 | 13 |
| 14 #define ARRAYSIZE_UNSAFE(a) \ | 14 #define ARRAYSIZE_UNSAFE(a) \ |
| 15 ((sizeof(a) / sizeof(*(a))) / \ | 15 ((sizeof(a) / sizeof(*(a))) / \ |
| 16 static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) | 16 static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) |
| 17 | 17 |
| 18 REGISTER_TEST_CASE(Audio); | 18 REGISTER_TEST_CASE(Audio); |
| 19 | 19 |
| 20 bool TestAudio::Init() { | 20 bool TestAudio::Init() { |
| 21 audio_interface_ = static_cast<PPB_Audio const*>( | 21 audio_interface_ = static_cast<const PPB_Audio*>( |
| 22 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_INTERFACE)); | 22 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_INTERFACE)); |
| 23 audio_config_interface_ = static_cast<PPB_AudioConfig const*>( | 23 audio_config_interface_ = static_cast<const PPB_AudioConfig*>( |
| 24 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE)); | 24 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE)); |
| 25 core_interface_ = static_cast<const PPB_Core*>( | 25 core_interface_ = static_cast<const PPB_Core*>( |
| 26 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); | 26 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); |
| 27 return audio_interface_ && audio_config_interface_ && core_interface_; | 27 return audio_interface_ && audio_config_interface_ && core_interface_; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void TestAudio::RunTests(const std::string& filter) { | 30 void TestAudio::RunTests(const std::string& filter) { |
| 31 RUN_TEST(Creation, filter); | 31 RUN_TEST(Creation, filter); |
| 32 RUN_TEST(DestroyNoStop, filter); | 32 RUN_TEST(DestroyNoStop, filter); |
| 33 RUN_TEST(Failures, filter); | 33 RUN_TEST(Failures, filter); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Test the other functions with an invalid audio resource. | 159 // Test the other functions with an invalid audio resource. |
| 160 ASSERT_FALSE(audio_interface_->IsAudio(0)); | 160 ASSERT_FALSE(audio_interface_->IsAudio(0)); |
| 161 ASSERT_EQ(0, audio_interface_->GetCurrentConfig(0)); | 161 ASSERT_EQ(0, audio_interface_->GetCurrentConfig(0)); |
| 162 ASSERT_FALSE(audio_interface_->StartPlayback(0)); | 162 ASSERT_FALSE(audio_interface_->StartPlayback(0)); |
| 163 ASSERT_FALSE(audio_interface_->StopPlayback(0)); | 163 ASSERT_FALSE(audio_interface_->StopPlayback(0)); |
| 164 | 164 |
| 165 PASS(); | 165 PASS(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 // TODO(viettrungluu): Test that callbacks get called, playback happens, etc. | 168 // TODO(viettrungluu): Test that callbacks get called, playback happens, etc. |
| OLD | NEW |