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

Side by Side Diff: webrtc/modules/audio_processing/transient/file_utils_unittest.cc

Issue 1547343002: Remove DISABLED_ON_ macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: MAYBE_ yo Created 4 years, 11 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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/modules/audio_processing/transient/file_utils.h" 11 #include "webrtc/modules/audio_processing/transient/file_utils.h"
12 12
13 #include <string.h> 13 #include <string.h>
14 #include <string> 14 #include <string>
15 15
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
18 #include "webrtc/system_wrappers/include/file_wrapper.h" 18 #include "webrtc/system_wrappers/include/file_wrapper.h"
19 #include "webrtc/test/testsupport/fileutils.h" 19 #include "webrtc/test/testsupport/fileutils.h"
20 #include "webrtc/test/testsupport/gtest_disable.h"
21 #include "webrtc/typedefs.h" 20 #include "webrtc/typedefs.h"
22 21
23 namespace webrtc { 22 namespace webrtc {
24 23
25 static const uint8_t kPiBytesf[4] = {0xDB, 0x0F, 0x49, 0x40}; 24 static const uint8_t kPiBytesf[4] = {0xDB, 0x0F, 0x49, 0x40};
26 static const uint8_t kEBytesf[4] = {0x54, 0xF8, 0x2D, 0x40}; 25 static const uint8_t kEBytesf[4] = {0x54, 0xF8, 0x2D, 0x40};
27 static const uint8_t kAvogadroBytesf[4] = {0x2F, 0x0C, 0xFF, 0x66}; 26 static const uint8_t kAvogadroBytesf[4] = {0x2F, 0x0C, 0xFF, 0x66};
28 27
29 static const uint8_t kPiBytes[8] = 28 static const uint8_t kPiBytes[8] =
30 {0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40}; 29 {0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40};
(...skipping 21 matching lines...) Expand all
52 // appended in that order. 51 // appended in that order.
53 const std::string kTestFileName; 52 const std::string kTestFileName;
54 53
55 // This file (used in some tests) contains binary data. The data correspond to 54 // This file (used in some tests) contains binary data. The data correspond to
56 // the float representation of the constants: Pi, E, and the Avogadro's 55 // the float representation of the constants: Pi, E, and the Avogadro's
57 // Number; 56 // Number;
58 // appended in that order. 57 // appended in that order.
59 const std::string kTestFileNamef; 58 const std::string kTestFileNamef;
60 }; 59 };
61 60
62 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertByteArrayToFloat)) { 61 #if defined(WEBRTC_IOS)
62 #define MAYBE_ConvertByteArrayToFloat DISABLED_ConvertByteArrayToFloat
63 #else
64 #define MAYBE_ConvertByteArrayToFloat ConvertByteArrayToFloat
65 #endif
66 TEST_F(TransientFileUtilsTest, MAYBE_ConvertByteArrayToFloat) {
63 float value = 0.0; 67 float value = 0.0;
64 68
65 EXPECT_EQ(0, ConvertByteArrayToFloat(kPiBytesf, &value)); 69 EXPECT_EQ(0, ConvertByteArrayToFloat(kPiBytesf, &value));
66 EXPECT_FLOAT_EQ(kPi, value); 70 EXPECT_FLOAT_EQ(kPi, value);
67 71
68 EXPECT_EQ(0, ConvertByteArrayToFloat(kEBytesf, &value)); 72 EXPECT_EQ(0, ConvertByteArrayToFloat(kEBytesf, &value));
69 EXPECT_FLOAT_EQ(kE, value); 73 EXPECT_FLOAT_EQ(kE, value);
70 74
71 EXPECT_EQ(0, ConvertByteArrayToFloat(kAvogadroBytesf, &value)); 75 EXPECT_EQ(0, ConvertByteArrayToFloat(kAvogadroBytesf, &value));
72 EXPECT_FLOAT_EQ(kAvogadro, value); 76 EXPECT_FLOAT_EQ(kAvogadro, value);
73 } 77 }
74 78
75 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertByteArrayToDouble)) { 79 #if defined(WEBRTC_IOS)
80 #define MAYBE_ConvertByteArrayToDouble DISABLED_ConvertByteArrayToDouble
81 #else
82 #define MAYBE_ConvertByteArrayToDouble ConvertByteArrayToDouble
83 #endif
84 TEST_F(TransientFileUtilsTest, MAYBE_ConvertByteArrayToDouble) {
76 double value = 0.0; 85 double value = 0.0;
77 86
78 EXPECT_EQ(0, ConvertByteArrayToDouble(kPiBytes, &value)); 87 EXPECT_EQ(0, ConvertByteArrayToDouble(kPiBytes, &value));
79 EXPECT_DOUBLE_EQ(kPi, value); 88 EXPECT_DOUBLE_EQ(kPi, value);
80 89
81 EXPECT_EQ(0, ConvertByteArrayToDouble(kEBytes, &value)); 90 EXPECT_EQ(0, ConvertByteArrayToDouble(kEBytes, &value));
82 EXPECT_DOUBLE_EQ(kE, value); 91 EXPECT_DOUBLE_EQ(kE, value);
83 92
84 EXPECT_EQ(0, ConvertByteArrayToDouble(kAvogadroBytes, &value)); 93 EXPECT_EQ(0, ConvertByteArrayToDouble(kAvogadroBytes, &value));
85 EXPECT_DOUBLE_EQ(kAvogadro, value); 94 EXPECT_DOUBLE_EQ(kAvogadro, value);
86 } 95 }
87 96
88 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertFloatToByteArray)) { 97 #if defined(WEBRTC_IOS)
98 #define MAYBE_ConvertFloatToByteArray DISABLED_ConvertFloatToByteArray
99 #else
100 #define MAYBE_ConvertFloatToByteArray ConvertFloatToByteArray
101 #endif
102 TEST_F(TransientFileUtilsTest, MAYBE_ConvertFloatToByteArray) {
89 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[4]); 103 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[4]);
90 104
91 EXPECT_EQ(0, ConvertFloatToByteArray(kPi, bytes.get())); 105 EXPECT_EQ(0, ConvertFloatToByteArray(kPi, bytes.get()));
92 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytesf, 4)); 106 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytesf, 4));
93 107
94 EXPECT_EQ(0, ConvertFloatToByteArray(kE, bytes.get())); 108 EXPECT_EQ(0, ConvertFloatToByteArray(kE, bytes.get()));
95 EXPECT_EQ(0, memcmp(bytes.get(), kEBytesf, 4)); 109 EXPECT_EQ(0, memcmp(bytes.get(), kEBytesf, 4));
96 110
97 EXPECT_EQ(0, ConvertFloatToByteArray(kAvogadro, bytes.get())); 111 EXPECT_EQ(0, ConvertFloatToByteArray(kAvogadro, bytes.get()));
98 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytesf, 4)); 112 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytesf, 4));
99 } 113 }
100 114
101 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertDoubleToByteArray)) { 115 #if defined(WEBRTC_IOS)
116 #define MAYBE_ConvertDoubleToByteArray DISABLED_ConvertDoubleToByteArray
117 #else
118 #define MAYBE_ConvertDoubleToByteArray ConvertDoubleToByteArray
119 #endif
120 TEST_F(TransientFileUtilsTest, MAYBE_ConvertDoubleToByteArray) {
102 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[8]); 121 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[8]);
103 122
104 EXPECT_EQ(0, ConvertDoubleToByteArray(kPi, bytes.get())); 123 EXPECT_EQ(0, ConvertDoubleToByteArray(kPi, bytes.get()));
105 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytes, 8)); 124 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytes, 8));
106 125
107 EXPECT_EQ(0, ConvertDoubleToByteArray(kE, bytes.get())); 126 EXPECT_EQ(0, ConvertDoubleToByteArray(kE, bytes.get()));
108 EXPECT_EQ(0, memcmp(bytes.get(), kEBytes, 8)); 127 EXPECT_EQ(0, memcmp(bytes.get(), kEBytes, 8));
109 128
110 EXPECT_EQ(0, ConvertDoubleToByteArray(kAvogadro, bytes.get())); 129 EXPECT_EQ(0, ConvertDoubleToByteArray(kAvogadro, bytes.get()));
111 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytes, 8)); 130 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytes, 8));
112 } 131 }
113 132
114 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadInt16BufferFromFile)) { 133 #if defined(WEBRTC_IOS)
134 #define MAYBE_ReadInt16BufferFromFile DISABLED_ReadInt16BufferFromFile
135 #else
136 #define MAYBE_ReadInt16BufferFromFile ReadInt16BufferFromFile
137 #endif
138 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16BufferFromFile) {
115 std::string test_filename = kTestFileName; 139 std::string test_filename = kTestFileName;
116 140
117 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 141 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
118 142
119 file->OpenFile(test_filename.c_str(), 143 file->OpenFile(test_filename.c_str(),
120 true, // Read only. 144 true, // Read only.
121 true, // Loop. 145 true, // Loop.
122 false); // No text. 146 false); // No text.
123 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 147 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
124 << kTestFileName.c_str(); 148 << kTestFileName.c_str();
(...skipping 17 matching lines...) Expand all
142 buffer.reset(new int16_t[kBufferLenghtLargerThanFile]); 166 buffer.reset(new int16_t[kBufferLenghtLargerThanFile]);
143 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(), 167 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
144 kBufferLenghtLargerThanFile, 168 kBufferLenghtLargerThanFile,
145 buffer.get())); 169 buffer.get()));
146 EXPECT_EQ(11544, buffer[0]); 170 EXPECT_EQ(11544, buffer[0]);
147 EXPECT_EQ(22377, buffer[4]); 171 EXPECT_EQ(22377, buffer[4]);
148 EXPECT_EQ(16389, buffer[7]); 172 EXPECT_EQ(16389, buffer[7]);
149 EXPECT_EQ(17631, buffer[kBufferLength - 1]); 173 EXPECT_EQ(17631, buffer[kBufferLength - 1]);
150 } 174 }
151 175
152 TEST_F(TransientFileUtilsTest, 176 #if defined(WEBRTC_IOS)
153 DISABLED_ON_IOS(ReadInt16FromFileToFloatBuffer)) { 177 #define MAYBE_ReadInt16FromFileToFloatBuffer \
178 DISABLED_ReadInt16FromFileToFloatBuffer
179 #else
180 #define MAYBE_ReadInt16FromFileToFloatBuffer ReadInt16FromFileToFloatBuffer
181 #endif
182 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16FromFileToFloatBuffer) {
154 std::string test_filename = kTestFileName; 183 std::string test_filename = kTestFileName;
155 184
156 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 185 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
157 186
158 file->OpenFile(test_filename.c_str(), 187 file->OpenFile(test_filename.c_str(),
159 true, // Read only. 188 true, // Read only.
160 true, // Loop. 189 true, // Loop.
161 false); // No text. 190 false); // No text.
162 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 191 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
163 << kTestFileName.c_str(); 192 << kTestFileName.c_str();
(...skipping 20 matching lines...) Expand all
184 EXPECT_EQ(kBufferLength, 213 EXPECT_EQ(kBufferLength,
185 ReadInt16FromFileToFloatBuffer(file.get(), 214 ReadInt16FromFileToFloatBuffer(file.get(),
186 kBufferLenghtLargerThanFile, 215 kBufferLenghtLargerThanFile,
187 buffer.get())); 216 buffer.get()));
188 EXPECT_DOUBLE_EQ(11544, buffer[0]); 217 EXPECT_DOUBLE_EQ(11544, buffer[0]);
189 EXPECT_DOUBLE_EQ(22377, buffer[4]); 218 EXPECT_DOUBLE_EQ(22377, buffer[4]);
190 EXPECT_DOUBLE_EQ(16389, buffer[7]); 219 EXPECT_DOUBLE_EQ(16389, buffer[7]);
191 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]); 220 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]);
192 } 221 }
193 222
194 TEST_F(TransientFileUtilsTest, 223 #if defined(WEBRTC_IOS)
195 DISABLED_ON_IOS(ReadInt16FromFileToDoubleBuffer)) { 224 #define MAYBE_ReadInt16FromFileToDoubleBuffer \
225 DISABLED_ReadInt16FromFileToDoubleBuffer
226 #else
227 #define MAYBE_ReadInt16FromFileToDoubleBuffer ReadInt16FromFileToDoubleBuffer
228 #endif
229 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16FromFileToDoubleBuffer) {
196 std::string test_filename = kTestFileName; 230 std::string test_filename = kTestFileName;
197 231
198 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 232 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
199 233
200 file->OpenFile(test_filename.c_str(), 234 file->OpenFile(test_filename.c_str(),
201 true, // Read only. 235 true, // Read only.
202 true, // Loop. 236 true, // Loop.
203 false); // No text. 237 false); // No text.
204 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 238 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
205 << kTestFileName.c_str(); 239 << kTestFileName.c_str();
(...skipping 19 matching lines...) Expand all
225 EXPECT_EQ(kBufferLength, 259 EXPECT_EQ(kBufferLength,
226 ReadInt16FromFileToDoubleBuffer(file.get(), 260 ReadInt16FromFileToDoubleBuffer(file.get(),
227 kBufferLenghtLargerThanFile, 261 kBufferLenghtLargerThanFile,
228 buffer.get())); 262 buffer.get()));
229 EXPECT_DOUBLE_EQ(11544, buffer[0]); 263 EXPECT_DOUBLE_EQ(11544, buffer[0]);
230 EXPECT_DOUBLE_EQ(22377, buffer[4]); 264 EXPECT_DOUBLE_EQ(22377, buffer[4]);
231 EXPECT_DOUBLE_EQ(16389, buffer[7]); 265 EXPECT_DOUBLE_EQ(16389, buffer[7]);
232 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]); 266 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]);
233 } 267 }
234 268
235 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadFloatBufferFromFile)) { 269 #if defined(WEBRTC_IOS)
270 #define MAYBE_ReadFloatBufferFromFile DISABLED_ReadFloatBufferFromFile
271 #else
272 #define MAYBE_ReadFloatBufferFromFile ReadFloatBufferFromFile
273 #endif
274 TEST_F(TransientFileUtilsTest, MAYBE_ReadFloatBufferFromFile) {
236 std::string test_filename = kTestFileNamef; 275 std::string test_filename = kTestFileNamef;
237 276
238 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 277 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
239 278
240 file->OpenFile(test_filename.c_str(), 279 file->OpenFile(test_filename.c_str(),
241 true, // Read only. 280 true, // Read only.
242 true, // Loop. 281 true, // Loop.
243 false); // No text. 282 false); // No text.
244 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 283 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
245 << kTestFileNamef.c_str(); 284 << kTestFileNamef.c_str();
(...skipping 16 matching lines...) Expand all
262 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2; 301 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
263 buffer.reset(new float[kBufferLenghtLargerThanFile]); 302 buffer.reset(new float[kBufferLenghtLargerThanFile]);
264 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(), 303 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
265 kBufferLenghtLargerThanFile, 304 kBufferLenghtLargerThanFile,
266 buffer.get())); 305 buffer.get()));
267 EXPECT_FLOAT_EQ(kPi, buffer[0]); 306 EXPECT_FLOAT_EQ(kPi, buffer[0]);
268 EXPECT_FLOAT_EQ(kE, buffer[1]); 307 EXPECT_FLOAT_EQ(kE, buffer[1]);
269 EXPECT_FLOAT_EQ(kAvogadro, buffer[2]); 308 EXPECT_FLOAT_EQ(kAvogadro, buffer[2]);
270 } 309 }
271 310
272 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadDoubleBufferFromFile)) { 311 #if defined(WEBRTC_IOS)
312 #define MAYBE_ReadDoubleBufferFromFile DISABLED_ReadDoubleBufferFromFile
313 #else
314 #define MAYBE_ReadDoubleBufferFromFile ReadDoubleBufferFromFile
315 #endif
316 TEST_F(TransientFileUtilsTest, MAYBE_ReadDoubleBufferFromFile) {
273 std::string test_filename = kTestFileName; 317 std::string test_filename = kTestFileName;
274 318
275 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 319 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
276 320
277 file->OpenFile(test_filename.c_str(), 321 file->OpenFile(test_filename.c_str(),
278 true, // Read only. 322 true, // Read only.
279 true, // Loop. 323 true, // Loop.
280 false); // No text. 324 false); // No text.
281 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 325 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
282 << kTestFileName.c_str(); 326 << kTestFileName.c_str();
(...skipping 16 matching lines...) Expand all
299 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2; 343 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
300 buffer.reset(new double[kBufferLenghtLargerThanFile]); 344 buffer.reset(new double[kBufferLenghtLargerThanFile]);
301 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(), 345 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
302 kBufferLenghtLargerThanFile, 346 kBufferLenghtLargerThanFile,
303 buffer.get())); 347 buffer.get()));
304 EXPECT_DOUBLE_EQ(kPi, buffer[0]); 348 EXPECT_DOUBLE_EQ(kPi, buffer[0]);
305 EXPECT_DOUBLE_EQ(kE, buffer[1]); 349 EXPECT_DOUBLE_EQ(kE, buffer[1]);
306 EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]); 350 EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]);
307 } 351 }
308 352
309 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteInt16BufferToFile)) { 353 #if defined(WEBRTC_IOS)
354 #define MAYBE_WriteInt16BufferToFile DISABLED_WriteInt16BufferToFile
355 #else
356 #define MAYBE_WriteInt16BufferToFile WriteInt16BufferToFile
357 #endif
358 TEST_F(TransientFileUtilsTest, MAYBE_WriteInt16BufferToFile) {
310 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 359 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
311 360
312 std::string kOutFileName = test::TempFilename(test::OutputPath(), 361 std::string kOutFileName = test::TempFilename(test::OutputPath(),
313 "utils_test"); 362 "utils_test");
314 363
315 file->OpenFile(kOutFileName.c_str(), 364 file->OpenFile(kOutFileName.c_str(),
316 false, // Write mode. 365 false, // Write mode.
317 false, // No loop. 366 false, // No loop.
318 false); // No text. 367 false); // No text.
319 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 368 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
341 << kOutFileName.c_str(); 390 << kOutFileName.c_str();
342 391
343 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(), 392 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
344 kBufferLength, 393 kBufferLength,
345 read_buffer.get())); 394 read_buffer.get()));
346 EXPECT_EQ(0, memcmp(written_buffer.get(), 395 EXPECT_EQ(0, memcmp(written_buffer.get(),
347 read_buffer.get(), 396 read_buffer.get(),
348 kBufferLength * sizeof(written_buffer[0]))); 397 kBufferLength * sizeof(written_buffer[0])));
349 } 398 }
350 399
351 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteFloatBufferToFile)) { 400 #if defined(WEBRTC_IOS)
401 #define MAYBE_WriteFloatBufferToFile DISABLED_WriteFloatBufferToFile
402 #else
403 #define MAYBE_WriteFloatBufferToFile WriteFloatBufferToFile
404 #endif
405 TEST_F(TransientFileUtilsTest, MAYBE_WriteFloatBufferToFile) {
352 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 406 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
353 407
354 std::string kOutFileName = test::TempFilename(test::OutputPath(), 408 std::string kOutFileName = test::TempFilename(test::OutputPath(),
355 "utils_test"); 409 "utils_test");
356 410
357 file->OpenFile(kOutFileName.c_str(), 411 file->OpenFile(kOutFileName.c_str(),
358 false, // Write mode. 412 false, // Write mode.
359 false, // No loop. 413 false, // No loop.
360 false); // No text. 414 false); // No text.
361 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 415 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
383 << kOutFileName.c_str(); 437 << kOutFileName.c_str();
384 438
385 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(), 439 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
386 kBufferLength, 440 kBufferLength,
387 read_buffer.get())); 441 read_buffer.get()));
388 EXPECT_EQ(0, memcmp(written_buffer.get(), 442 EXPECT_EQ(0, memcmp(written_buffer.get(),
389 read_buffer.get(), 443 read_buffer.get(),
390 kBufferLength * sizeof(written_buffer[0]))); 444 kBufferLength * sizeof(written_buffer[0])));
391 } 445 }
392 446
393 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteDoubleBufferToFile)) { 447 #if defined(WEBRTC_IOS)
448 #define MAYBE_WriteDoubleBufferToFile DISABLED_WriteDoubleBufferToFile
449 #else
450 #define MAYBE_WriteDoubleBufferToFile WriteDoubleBufferToFile
451 #endif
452 TEST_F(TransientFileUtilsTest, MAYBE_WriteDoubleBufferToFile) {
394 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 453 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
395 454
396 std::string kOutFileName = test::TempFilename(test::OutputPath(), 455 std::string kOutFileName = test::TempFilename(test::OutputPath(),
397 "utils_test"); 456 "utils_test");
398 457
399 file->OpenFile(kOutFileName.c_str(), 458 file->OpenFile(kOutFileName.c_str(),
400 false, // Write mode. 459 false, // Write mode.
401 false, // No loop. 460 false, // No loop.
402 false); // No text. 461 false); // No text.
403 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 462 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
425 << kOutFileName.c_str(); 484 << kOutFileName.c_str();
426 485
427 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(), 486 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
428 kBufferLength, 487 kBufferLength,
429 read_buffer.get())); 488 read_buffer.get()));
430 EXPECT_EQ(0, memcmp(written_buffer.get(), 489 EXPECT_EQ(0, memcmp(written_buffer.get(),
431 read_buffer.get(), 490 read_buffer.get(),
432 kBufferLength * sizeof(written_buffer[0]))); 491 kBufferLength * sizeof(written_buffer[0])));
433 } 492 }
434 493
435 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ExpectedErrorReturnValues)) { 494 #if defined(WEBRTC_IOS)
495 #define MAYBE_ExpectedErrorReturnValues DISABLED_ExpectedErrorReturnValues
496 #else
497 #define MAYBE_ExpectedErrorReturnValues ExpectedErrorReturnValues
498 #endif
499 TEST_F(TransientFileUtilsTest, MAYBE_ExpectedErrorReturnValues) {
436 std::string test_filename = kTestFileName; 500 std::string test_filename = kTestFileName;
437 501
438 double value; 502 double value;
439 rtc::scoped_ptr<int16_t[]> int16_buffer(new int16_t[1]); 503 rtc::scoped_ptr<int16_t[]> int16_buffer(new int16_t[1]);
440 rtc::scoped_ptr<double[]> double_buffer(new double[1]); 504 rtc::scoped_ptr<double[]> double_buffer(new double[1]);
441 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 505 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
442 506
443 EXPECT_EQ(-1, ConvertByteArrayToDouble(NULL, &value)); 507 EXPECT_EQ(-1, ConvertByteArrayToDouble(NULL, &value));
444 EXPECT_EQ(-1, ConvertByteArrayToDouble(kPiBytes, NULL)); 508 EXPECT_EQ(-1, ConvertByteArrayToDouble(kPiBytes, NULL));
445 509
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 1, NULL)); 543 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 1, NULL));
480 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 0, int16_buffer.get())); 544 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 0, int16_buffer.get()));
481 545
482 EXPECT_EQ(0u, WriteDoubleBufferToFile(NULL, 1, double_buffer.get())); 546 EXPECT_EQ(0u, WriteDoubleBufferToFile(NULL, 1, double_buffer.get()));
483 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 1, NULL)); 547 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 1, NULL));
484 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 0, double_buffer.get())); 548 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 0, double_buffer.get()));
485 } 549 }
486 550
487 } // namespace webrtc 551 } // namespace webrtc
488 552
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698