| 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 | 5 |
| 6 #include <nacl/nacl_log.h> | 6 #include <nacl/nacl_log.h> |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // To enable basic tests, use basic_tests="1" in the embed tag. | 144 // To enable basic tests, use basic_tests="1" in the embed tag. |
| 145 void BasicTests() { | 145 void BasicTests() { |
| 146 // Verify obtained_sample_frame_count isn't out of range. | 146 // Verify obtained_sample_frame_count isn't out of range. |
| 147 CHECK(obtained_sample_frame_count_ >= PP_AUDIOMINSAMPLEFRAMECOUNT); | 147 CHECK(obtained_sample_frame_count_ >= PP_AUDIOMINSAMPLEFRAMECOUNT); |
| 148 CHECK(obtained_sample_frame_count_ <= PP_AUDIOMAXSAMPLEFRAMECOUNT); | 148 CHECK(obtained_sample_frame_count_ <= PP_AUDIOMAXSAMPLEFRAMECOUNT); |
| 149 // Do some sanity checks below; verify c & cpp interfaces agree. | 149 // Do some sanity checks below; verify c & cpp interfaces agree. |
| 150 // Note: This is test code and is not normally needed for an application. | 150 // Note: This is test code and is not normally needed for an application. |
| 151 PPB_GetInterface get_browser_interface = | 151 PPB_GetInterface get_browser_interface = |
| 152 pp::Module::Get()->get_browser_interface(); | 152 pp::Module::Get()->get_browser_interface(); |
| 153 const struct PPB_AudioConfig* audio_config_interface = | 153 const PPB_AudioConfig* audio_config_interface = |
| 154 static_cast<const struct PPB_AudioConfig*>( | 154 static_cast<const PPB_AudioConfig*>( |
| 155 get_browser_interface(PPB_AUDIO_CONFIG_INTERFACE)); | 155 get_browser_interface(PPB_AUDIO_CONFIG_INTERFACE)); |
| 156 const struct PPB_Audio* audio_interface = | 156 const PPB_Audio* audio_interface = |
| 157 static_cast<const struct PPB_Audio*>( | 157 static_cast<const PPB_Audio*>( |
| 158 get_browser_interface(PPB_AUDIO_INTERFACE)); | 158 get_browser_interface(PPB_AUDIO_INTERFACE)); |
| 159 PP_Resource audio_config_resource = config_->pp_resource(); | 159 PP_Resource audio_config_resource = config_->pp_resource(); |
| 160 PP_Resource audio_resource = audio_->pp_resource(); | 160 PP_Resource audio_resource = audio_->pp_resource(); |
| 161 NaClLog(1, "example: audio config resource: %"NACL_PRId32"\n", | 161 NaClLog(1, "example: audio config resource: %"NACL_PRId32"\n", |
| 162 audio_config_resource); | 162 audio_config_resource); |
| 163 NaClLog(1, "example: audio resource: %"NACL_PRId32"\n", audio_resource); | 163 NaClLog(1, "example: audio resource: %"NACL_PRId32"\n", audio_resource); |
| 164 CHECK(PP_TRUE == audio_config_interface-> | 164 CHECK(PP_TRUE == audio_config_interface-> |
| 165 IsAudioConfig(audio_config_resource)); | 165 IsAudioConfig(audio_config_resource)); |
| 166 CHECK(PP_TRUE == audio_interface->IsAudio(audio_resource)); | 166 CHECK(PP_TRUE == audio_interface->IsAudio(audio_resource)); |
| 167 CHECK(PP_FALSE == audio_config_interface->IsAudioConfig(audio_resource)); | 167 CHECK(PP_FALSE == audio_config_interface->IsAudioConfig(audio_resource)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 namespace pp { | 293 namespace pp { |
| 294 | 294 |
| 295 // Factory function for your specialization of the Module object. | 295 // Factory function for your specialization of the Module object. |
| 296 Module* CreateModule() { | 296 Module* CreateModule() { |
| 297 NaClLogModuleInit(); | 297 NaClLogModuleInit(); |
| 298 return new MyModule(); | 298 return new MyModule(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace pp | 301 } // namespace pp |
| OLD | NEW |