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