cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / tests / test_audio.h
blobdb86d1fd062dfaa8632f919d47b2da7eea3f8ef1
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();
32 // Calls |audio_callback_method_| (where |user_data| is "this").
33 static void AudioCallbackTrampoline(void* sample_buffer,
34 uint32_t buffer_size_in_bytes,
35 void* user_data);
37 typedef void (TestAudio::*AudioCallbackMethod)(void* sample_buffer,
38 uint32_t buffer_size_in_bytes);
40 // Method called by |AudioCallbackTrampoline()|. Set only when the callback
41 // can't be running (before |StartPlayback()|, after |StopPlayback()| or
42 // releasing the last reference to the audio resource).
43 AudioCallbackMethod audio_callback_method_;
45 // An |AudioCallbackMethod| that just clears |sample_buffer|.
46 void AudioCallbackTrivial(void* sample_buffer, uint32_t buffer_size_in_bytes);
48 // |AudioCallbackMethod| used by |TestAudioCallbackN()|.
49 void AudioCallbackTest(void* sample_buffer, uint32_t buffer_size_in_bytes);
51 // Used by |TestAudioCallbackN()|.
52 NestedEvent audio_callback_event_;
54 bool test_done_;
55 bool callback_fired_;
57 // Raw C-level interfaces, set in |Init()|; do not modify them elsewhere.
58 const PPB_Audio* audio_interface_;
59 const PPB_AudioConfig* audio_config_interface_;
60 const PPB_Core* core_interface_;
63 #endif // PAPPI_TESTS_TEST_AUDIO_H_