Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: ppapi/tests/test_audio_config.cc

Issue 8764004: Add DEPS include rules so we don't accidentally use base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove rules to include self where possible Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/pp_thread.h ('k') | ppapi/tests/test_file_io.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_config.h" 5 #include "ppapi/tests/test_audio_config.h"
6 6
7 #include "base/basictypes.h" // For |arraysize()|.
8 #include "ppapi/c/ppb_audio_config.h" 7 #include "ppapi/c/ppb_audio_config.h"
9 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
10 #include "ppapi/tests/testing_instance.h" 9 #include "ppapi/tests/testing_instance.h"
11 10
12 REGISTER_TEST_CASE(AudioConfig); 11 REGISTER_TEST_CASE(AudioConfig);
13 12
14 bool TestAudioConfig::Init() { 13 bool TestAudioConfig::Init() {
15 audio_config_interface_ = static_cast<PPB_AudioConfig const*>( 14 audio_config_interface_ = static_cast<PPB_AudioConfig const*>(
16 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE)); 15 pp::Module::Get()->GetBrowserInterface(PPB_AUDIO_CONFIG_INTERFACE));
17 core_interface_ = static_cast<const PPB_Core*>( 16 core_interface_ = static_cast<const PPB_Core*>(
(...skipping 13 matching lines...) Expand all
31 }; 30 };
32 static const uint32_t kRequestFrameCounts[] = { 31 static const uint32_t kRequestFrameCounts[] = {
33 PP_AUDIOMINSAMPLEFRAMECOUNT, 32 PP_AUDIOMINSAMPLEFRAMECOUNT,
34 PP_AUDIOMAXSAMPLEFRAMECOUNT, 33 PP_AUDIOMAXSAMPLEFRAMECOUNT,
35 // Include some "okay-looking" frame counts; check their validity below. 34 // Include some "okay-looking" frame counts; check their validity below.
36 1024, 35 1024,
37 2048, 36 2048,
38 4096 37 4096
39 }; 38 };
40 39
41 for (size_t i = 0; i < arraysize(kSampleRates); i++) { 40 for (size_t i = 0; i < sizeof(kSampleRates)/sizeof(kSampleRates[0]); i++) {
42 PP_AudioSampleRate sample_rate = kSampleRates[i]; 41 PP_AudioSampleRate sample_rate = kSampleRates[i];
43 42
44 for (size_t j = 0; j < arraysize(kRequestFrameCounts); j++) { 43 for (size_t j = 0;
44 j < sizeof(kRequestFrameCounts)/sizeof(kRequestFrameCounts);
45 j++) {
45 uint32_t request_frame_count = kRequestFrameCounts[j]; 46 uint32_t request_frame_count = kRequestFrameCounts[j];
46 ASSERT_TRUE(request_frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); 47 ASSERT_TRUE(request_frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT);
47 ASSERT_TRUE(request_frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); 48 ASSERT_TRUE(request_frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT);
48 49
49 uint32_t frame_count = audio_config_interface_->RecommendSampleFrameCount( 50 uint32_t frame_count = audio_config_interface_->RecommendSampleFrameCount(
50 sample_rate, request_frame_count); 51 sample_rate, request_frame_count);
51 ASSERT_TRUE(frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT); 52 ASSERT_TRUE(frame_count >= PP_AUDIOMINSAMPLEFRAMECOUNT);
52 ASSERT_TRUE(frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT); 53 ASSERT_TRUE(frame_count <= PP_AUDIOMAXSAMPLEFRAMECOUNT);
53 54
54 PP_Resource ac = audio_config_interface_->CreateStereo16Bit( 55 PP_Resource ac = audio_config_interface_->CreateStereo16Bit(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 PP_AUDIOMAXSAMPLEFRAMECOUNT + 1u); 87 PP_AUDIOMAXSAMPLEFRAMECOUNT + 1u);
87 ASSERT_EQ(0, ac); 88 ASSERT_EQ(0, ac);
88 89
89 // Test rest of API whose failure cases are defined. 90 // Test rest of API whose failure cases are defined.
90 ASSERT_FALSE(audio_config_interface_->IsAudioConfig(0)); 91 ASSERT_FALSE(audio_config_interface_->IsAudioConfig(0));
91 ASSERT_EQ(PP_AUDIOSAMPLERATE_NONE, audio_config_interface_->GetSampleRate(0)); 92 ASSERT_EQ(PP_AUDIOSAMPLERATE_NONE, audio_config_interface_->GetSampleRate(0));
92 ASSERT_EQ(0u, audio_config_interface_->GetSampleFrameCount(0)); 93 ASSERT_EQ(0u, audio_config_interface_->GetSampleFrameCount(0));
93 94
94 PASS(); 95 PASS();
95 } 96 }
OLDNEW
« no previous file with comments | « ppapi/tests/pp_thread.h ('k') | ppapi/tests/test_file_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698