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

Side by Side Diff: webrtc/sound/automaticallychosensoundsystem_unittest.cc

Issue 1405023016: Convert usage of ARRAY_SIZE to arraysize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: static_cast<int> Created 5 years, 1 month 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
« no previous file with comments | « webrtc/sound/alsasoundsystem.cc ('k') | webrtc/sound/linuxsoundsystem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/sound/automaticallychosensoundsystem.h" 11 #include "webrtc/sound/automaticallychosensoundsystem.h"
12
13 #include "webrtc/base/arraysize.h"
14 #include "webrtc/base/gunit.h"
12 #include "webrtc/sound/nullsoundsystem.h" 15 #include "webrtc/sound/nullsoundsystem.h"
13 #include "webrtc/base/gunit.h"
14 16
15 namespace rtc { 17 namespace rtc {
16 18
17 class NeverFailsToFailSoundSystem : public NullSoundSystem { 19 class NeverFailsToFailSoundSystem : public NullSoundSystem {
18 public: 20 public:
19 // Overrides superclass. 21 // Overrides superclass.
20 virtual bool Init() { 22 virtual bool Init() {
21 return false; 23 return false;
22 } 24 }
23 25
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 107
106 bool DeletionCheckingSoundSystem3::deleted_ = false; 108 bool DeletionCheckingSoundSystem3::deleted_ = false;
107 109
108 extern const SoundSystemCreator kSingleSystemFailingCreators[] = { 110 extern const SoundSystemCreator kSingleSystemFailingCreators[] = {
109 &NeverFailsToFailSoundSystem::Create, 111 &NeverFailsToFailSoundSystem::Create,
110 }; 112 };
111 113
112 TEST(AutomaticallyChosenSoundSystem, SingleSystemFailing) { 114 TEST(AutomaticallyChosenSoundSystem, SingleSystemFailing) {
113 AutomaticallyChosenSoundSystem< 115 AutomaticallyChosenSoundSystem<
114 kSingleSystemFailingCreators, 116 kSingleSystemFailingCreators,
115 ARRAY_SIZE(kSingleSystemFailingCreators)> sound_system; 117 arraysize(kSingleSystemFailingCreators)> sound_system;
116 EXPECT_FALSE(sound_system.Init()); 118 EXPECT_FALSE(sound_system.Init());
117 } 119 }
118 120
119 extern const SoundSystemCreator kSingleSystemSucceedingCreators[] = { 121 extern const SoundSystemCreator kSingleSystemSucceedingCreators[] = {
120 &NullSoundSystem::Create, 122 &NullSoundSystem::Create,
121 }; 123 };
122 124
123 TEST(AutomaticallyChosenSoundSystem, SingleSystemSucceeding) { 125 TEST(AutomaticallyChosenSoundSystem, SingleSystemSucceeding) {
124 AutomaticallyChosenSoundSystem< 126 AutomaticallyChosenSoundSystem<
125 kSingleSystemSucceedingCreators, 127 kSingleSystemSucceedingCreators,
126 ARRAY_SIZE(kSingleSystemSucceedingCreators)> sound_system; 128 arraysize(kSingleSystemSucceedingCreators)> sound_system;
127 EXPECT_TRUE(sound_system.Init()); 129 EXPECT_TRUE(sound_system.Init());
128 } 130 }
129 131
130 extern const SoundSystemCreator 132 extern const SoundSystemCreator
131 kFailedFirstSystemResultsInUsingSecondCreators[] = { 133 kFailedFirstSystemResultsInUsingSecondCreators[] = {
132 &NeverFailsToFailSoundSystem::Create, 134 &NeverFailsToFailSoundSystem::Create,
133 &NullSoundSystem::Create, 135 &NullSoundSystem::Create,
134 }; 136 };
135 137
136 TEST(AutomaticallyChosenSoundSystem, FailedFirstSystemResultsInUsingSecond) { 138 TEST(AutomaticallyChosenSoundSystem, FailedFirstSystemResultsInUsingSecond) {
137 AutomaticallyChosenSoundSystem< 139 AutomaticallyChosenSoundSystem<
138 kFailedFirstSystemResultsInUsingSecondCreators, 140 kFailedFirstSystemResultsInUsingSecondCreators,
139 ARRAY_SIZE(kFailedFirstSystemResultsInUsingSecondCreators)> sound_system; 141 arraysize(kFailedFirstSystemResultsInUsingSecondCreators)> sound_system;
140 EXPECT_TRUE(sound_system.Init()); 142 EXPECT_TRUE(sound_system.Init());
141 } 143 }
142 144
143 extern const SoundSystemCreator kEarlierEntriesHavePriorityCreators[] = { 145 extern const SoundSystemCreator kEarlierEntriesHavePriorityCreators[] = {
144 &InitCheckingSoundSystem1::Create, 146 &InitCheckingSoundSystem1::Create,
145 &InitCheckingSoundSystem2::Create, 147 &InitCheckingSoundSystem2::Create,
146 }; 148 };
147 149
148 TEST(AutomaticallyChosenSoundSystem, EarlierEntriesHavePriority) { 150 TEST(AutomaticallyChosenSoundSystem, EarlierEntriesHavePriority) {
149 AutomaticallyChosenSoundSystem< 151 AutomaticallyChosenSoundSystem<
150 kEarlierEntriesHavePriorityCreators, 152 kEarlierEntriesHavePriorityCreators,
151 ARRAY_SIZE(kEarlierEntriesHavePriorityCreators)> sound_system; 153 arraysize(kEarlierEntriesHavePriorityCreators)> sound_system;
152 InitCheckingSoundSystem1::created_ = false; 154 InitCheckingSoundSystem1::created_ = false;
153 InitCheckingSoundSystem2::created_ = false; 155 InitCheckingSoundSystem2::created_ = false;
154 EXPECT_TRUE(sound_system.Init()); 156 EXPECT_TRUE(sound_system.Init());
155 EXPECT_TRUE(InitCheckingSoundSystem1::created_); 157 EXPECT_TRUE(InitCheckingSoundSystem1::created_);
156 EXPECT_FALSE(InitCheckingSoundSystem2::created_); 158 EXPECT_FALSE(InitCheckingSoundSystem2::created_);
157 } 159 }
158 160
159 extern const SoundSystemCreator kManySoundSystemsCreators[] = { 161 extern const SoundSystemCreator kManySoundSystemsCreators[] = {
160 &NullSoundSystem::Create, 162 &NullSoundSystem::Create,
161 &NullSoundSystem::Create, 163 &NullSoundSystem::Create,
162 &NullSoundSystem::Create, 164 &NullSoundSystem::Create,
163 &NullSoundSystem::Create, 165 &NullSoundSystem::Create,
164 &NullSoundSystem::Create, 166 &NullSoundSystem::Create,
165 &NullSoundSystem::Create, 167 &NullSoundSystem::Create,
166 &NullSoundSystem::Create, 168 &NullSoundSystem::Create,
167 }; 169 };
168 170
169 TEST(AutomaticallyChosenSoundSystem, ManySoundSystems) { 171 TEST(AutomaticallyChosenSoundSystem, ManySoundSystems) {
170 AutomaticallyChosenSoundSystem< 172 AutomaticallyChosenSoundSystem<
171 kManySoundSystemsCreators, 173 kManySoundSystemsCreators,
172 ARRAY_SIZE(kManySoundSystemsCreators)> sound_system; 174 arraysize(kManySoundSystemsCreators)> sound_system;
173 EXPECT_TRUE(sound_system.Init()); 175 EXPECT_TRUE(sound_system.Init());
174 } 176 }
175 177
176 extern const SoundSystemCreator kDeletesAllCreatedSoundSystemsCreators[] = { 178 extern const SoundSystemCreator kDeletesAllCreatedSoundSystemsCreators[] = {
177 &DeletionCheckingSoundSystem1::Create, 179 &DeletionCheckingSoundSystem1::Create,
178 &DeletionCheckingSoundSystem2::Create, 180 &DeletionCheckingSoundSystem2::Create,
179 &DeletionCheckingSoundSystem3::Create, 181 &DeletionCheckingSoundSystem3::Create,
180 }; 182 };
181 183
182 TEST(AutomaticallyChosenSoundSystem, DeletesAllCreatedSoundSystems) { 184 TEST(AutomaticallyChosenSoundSystem, DeletesAllCreatedSoundSystems) {
183 typedef AutomaticallyChosenSoundSystem< 185 typedef AutomaticallyChosenSoundSystem<
184 kDeletesAllCreatedSoundSystemsCreators, 186 kDeletesAllCreatedSoundSystemsCreators,
185 ARRAY_SIZE(kDeletesAllCreatedSoundSystemsCreators)> TestSoundSystem; 187 arraysize(kDeletesAllCreatedSoundSystemsCreators)> TestSoundSystem;
186 TestSoundSystem *sound_system = new TestSoundSystem(); 188 TestSoundSystem *sound_system = new TestSoundSystem();
187 DeletionCheckingSoundSystem1::deleted_ = false; 189 DeletionCheckingSoundSystem1::deleted_ = false;
188 DeletionCheckingSoundSystem2::deleted_ = false; 190 DeletionCheckingSoundSystem2::deleted_ = false;
189 DeletionCheckingSoundSystem3::deleted_ = false; 191 DeletionCheckingSoundSystem3::deleted_ = false;
190 EXPECT_TRUE(sound_system->Init()); 192 EXPECT_TRUE(sound_system->Init());
191 delete sound_system; 193 delete sound_system;
192 EXPECT_TRUE(DeletionCheckingSoundSystem1::deleted_); 194 EXPECT_TRUE(DeletionCheckingSoundSystem1::deleted_);
193 EXPECT_TRUE(DeletionCheckingSoundSystem2::deleted_); 195 EXPECT_TRUE(DeletionCheckingSoundSystem2::deleted_);
194 EXPECT_TRUE(DeletionCheckingSoundSystem3::deleted_); 196 EXPECT_TRUE(DeletionCheckingSoundSystem3::deleted_);
195 } 197 }
196 198
197 } // namespace rtc 199 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/sound/alsasoundsystem.cc ('k') | webrtc/sound/linuxsoundsystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698