Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / ppapi / tests / test_audio.h
blob56e6254e1891aca30bdbbd0863a6eefa901e320b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PAPPI_TESTS_TEST_AUDIO_H_
6 #define PAPPI_TESTS_TEST_AUDIO_H_
8 #include <string>
10 #include "ppapi/c/ppb_audio.h"
11 #include "ppapi/c/ppb_audio_config.h"
12 #include "ppapi/c/ppb_core.h"
13 #include "ppapi/tests/test_case.h"
15 class TestAudio : public TestCase {
16 public:
17 explicit TestAudio(TestingInstance* instance);
18 ~TestAudio();
20 // TestCase implementation.
21 virtual bool Init();
22 virtual void RunTests(const std::string& filter);
24 private:
25 std::string TestCreation();
26 std::string TestDestroyNoStop();
27 std::string TestFailures();
28 std::string TestAudioCallback1();
29 std::string TestAudioCallback2();
30 std::string TestAudioCallback3();
31 std::string TestAudioCallback4();
33 // Calls |audio_callback_method_| (where |user_data| is "this").
34 static void AudioCallbackTrampoline(void* sample_buffer,
35 uint32_t buffer_size_in_bytes,
36 PP_TimeDelta latency,
37 void* user_data);
38 static void AudioCallbackTrampoline1_0(void* sample_buffer,
39 uint32_t buffer_size_in_bytes,
40 void* user_data);
42 typedef void (TestAudio::*AudioCallbackMethod)(void* sample_buffer,
43 uint32_t buffer_size_in_bytes,
44 PP_TimeDelta latency);
46 // Method called by |AudioCallbackTrampoline()|. Set only when the callback
47 // can't be running (before |StartPlayback()|, after |StopPlayback()| or
48 // releasing the last reference to the audio resource).
49 AudioCallbackMethod audio_callback_method_;
51 // An |AudioCallbackMethod| that just clears |sample_buffer|.
52 void AudioCallbackTrivial(void* sample_buffer,
53 uint32_t buffer_size_in_bytes,
54 PP_TimeDelta latency);
56 // |AudioCallbackMethod| used by |TestAudioCallbackN()|.
57 void AudioCallbackTest(void* sample_buffer,
58 uint32_t buffer_size_in_bytes,
59 PP_TimeDelta latency);
61 PP_Resource CreateAudioConfig(PP_AudioSampleRate sample_rate,
62 uint32_t requested_sample_frame_count);
64 // Used by |TestAudioCallbackN()|.
65 NestedEvent audio_callback_event_;
67 bool test_done_;
69 // Raw C-level interfaces, set in |Init()|; do not modify them elsewhere.
70 const PPB_Audio_1_1* audio_interface_;
71 const PPB_Audio_1_0* audio_interface_1_0_;
72 const PPB_AudioConfig* audio_config_interface_;
73 const PPB_Core* core_interface_;
76 #endif // PAPPI_TESTS_TEST_AUDIO_H_