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

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

Issue 1171033002: Ensures that modules_unittests runs on iOS (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebased Created 5 years, 6 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/interface/file_wrapper.h" 18 #include "webrtc/system_wrappers/interface/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"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 static const uint8_t kPiBytesf[4] = {0xDB, 0x0F, 0x49, 0x40}; 25 static const uint8_t kPiBytesf[4] = {0xDB, 0x0F, 0x49, 0x40};
25 static const uint8_t kEBytesf[4] = {0x54, 0xF8, 0x2D, 0x40}; 26 static const uint8_t kEBytesf[4] = {0x54, 0xF8, 0x2D, 0x40};
26 static const uint8_t kAvogadroBytesf[4] = {0x2F, 0x0C, 0xFF, 0x66}; 27 static const uint8_t kAvogadroBytesf[4] = {0x2F, 0x0C, 0xFF, 0x66};
27 28
28 static const uint8_t kPiBytes[8] = 29 static const uint8_t kPiBytes[8] =
29 {0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40}; 30 {0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40};
(...skipping 21 matching lines...) Expand all
51 // appended in that order. 52 // appended in that order.
52 const std::string kTestFileName; 53 const std::string kTestFileName;
53 54
54 // This file (used in some tests) contains binary data. The data correspond to 55 // This file (used in some tests) contains binary data. The data correspond to
55 // the float representation of the constants: Pi, E, and the Avogadro's 56 // the float representation of the constants: Pi, E, and the Avogadro's
56 // Number; 57 // Number;
57 // appended in that order. 58 // appended in that order.
58 const std::string kTestFileNamef; 59 const std::string kTestFileNamef;
59 }; 60 };
60 61
61 TEST_F(TransientFileUtilsTest, ConvertByteArrayToFloat) { 62 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertByteArrayToFloat)) {
62 float value = 0.0; 63 float value = 0.0;
63 64
64 EXPECT_EQ(0, ConvertByteArrayToFloat(kPiBytesf, &value)); 65 EXPECT_EQ(0, ConvertByteArrayToFloat(kPiBytesf, &value));
65 EXPECT_FLOAT_EQ(kPi, value); 66 EXPECT_FLOAT_EQ(kPi, value);
66 67
67 EXPECT_EQ(0, ConvertByteArrayToFloat(kEBytesf, &value)); 68 EXPECT_EQ(0, ConvertByteArrayToFloat(kEBytesf, &value));
68 EXPECT_FLOAT_EQ(kE, value); 69 EXPECT_FLOAT_EQ(kE, value);
69 70
70 EXPECT_EQ(0, ConvertByteArrayToFloat(kAvogadroBytesf, &value)); 71 EXPECT_EQ(0, ConvertByteArrayToFloat(kAvogadroBytesf, &value));
71 EXPECT_FLOAT_EQ(kAvogadro, value); 72 EXPECT_FLOAT_EQ(kAvogadro, value);
72 } 73 }
73 74
74 TEST_F(TransientFileUtilsTest, ConvertByteArrayToDouble) { 75 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertByteArrayToDouble)) {
75 double value = 0.0; 76 double value = 0.0;
76 77
77 EXPECT_EQ(0, ConvertByteArrayToDouble(kPiBytes, &value)); 78 EXPECT_EQ(0, ConvertByteArrayToDouble(kPiBytes, &value));
78 EXPECT_DOUBLE_EQ(kPi, value); 79 EXPECT_DOUBLE_EQ(kPi, value);
79 80
80 EXPECT_EQ(0, ConvertByteArrayToDouble(kEBytes, &value)); 81 EXPECT_EQ(0, ConvertByteArrayToDouble(kEBytes, &value));
81 EXPECT_DOUBLE_EQ(kE, value); 82 EXPECT_DOUBLE_EQ(kE, value);
82 83
83 EXPECT_EQ(0, ConvertByteArrayToDouble(kAvogadroBytes, &value)); 84 EXPECT_EQ(0, ConvertByteArrayToDouble(kAvogadroBytes, &value));
84 EXPECT_DOUBLE_EQ(kAvogadro, value); 85 EXPECT_DOUBLE_EQ(kAvogadro, value);
85 } 86 }
86 87
87 TEST_F(TransientFileUtilsTest, ConvertFloatToByteArray) { 88 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertFloatToByteArray)) {
88 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[4]); 89 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[4]);
89 90
90 EXPECT_EQ(0, ConvertFloatToByteArray(kPi, bytes.get())); 91 EXPECT_EQ(0, ConvertFloatToByteArray(kPi, bytes.get()));
91 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytesf, 4)); 92 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytesf, 4));
92 93
93 EXPECT_EQ(0, ConvertFloatToByteArray(kE, bytes.get())); 94 EXPECT_EQ(0, ConvertFloatToByteArray(kE, bytes.get()));
94 EXPECT_EQ(0, memcmp(bytes.get(), kEBytesf, 4)); 95 EXPECT_EQ(0, memcmp(bytes.get(), kEBytesf, 4));
95 96
96 EXPECT_EQ(0, ConvertFloatToByteArray(kAvogadro, bytes.get())); 97 EXPECT_EQ(0, ConvertFloatToByteArray(kAvogadro, bytes.get()));
97 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytesf, 4)); 98 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytesf, 4));
98 } 99 }
99 100
100 TEST_F(TransientFileUtilsTest, ConvertDoubleToByteArray) { 101 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ConvertDoubleToByteArray)) {
101 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[8]); 102 rtc::scoped_ptr<uint8_t[]> bytes(new uint8_t[8]);
102 103
103 EXPECT_EQ(0, ConvertDoubleToByteArray(kPi, bytes.get())); 104 EXPECT_EQ(0, ConvertDoubleToByteArray(kPi, bytes.get()));
104 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytes, 8)); 105 EXPECT_EQ(0, memcmp(bytes.get(), kPiBytes, 8));
105 106
106 EXPECT_EQ(0, ConvertDoubleToByteArray(kE, bytes.get())); 107 EXPECT_EQ(0, ConvertDoubleToByteArray(kE, bytes.get()));
107 EXPECT_EQ(0, memcmp(bytes.get(), kEBytes, 8)); 108 EXPECT_EQ(0, memcmp(bytes.get(), kEBytes, 8));
108 109
109 EXPECT_EQ(0, ConvertDoubleToByteArray(kAvogadro, bytes.get())); 110 EXPECT_EQ(0, ConvertDoubleToByteArray(kAvogadro, bytes.get()));
110 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytes, 8)); 111 EXPECT_EQ(0, memcmp(bytes.get(), kAvogadroBytes, 8));
111 } 112 }
112 113
113 TEST_F(TransientFileUtilsTest, ReadInt16BufferFromFile) { 114 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadInt16BufferFromFile)) {
114 std::string test_filename = kTestFileName; 115 std::string test_filename = kTestFileName;
115 116
116 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 117 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
117 118
118 file->OpenFile(test_filename.c_str(), 119 file->OpenFile(test_filename.c_str(),
119 true, // Read only. 120 true, // Read only.
120 true, // Loop. 121 true, // Loop.
121 false); // No text. 122 false); // No text.
122 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 123 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
123 << kTestFileName.c_str(); 124 << kTestFileName.c_str();
(...skipping 17 matching lines...) Expand all
141 buffer.reset(new int16_t[kBufferLenghtLargerThanFile]); 142 buffer.reset(new int16_t[kBufferLenghtLargerThanFile]);
142 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(), 143 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
143 kBufferLenghtLargerThanFile, 144 kBufferLenghtLargerThanFile,
144 buffer.get())); 145 buffer.get()));
145 EXPECT_EQ(11544, buffer[0]); 146 EXPECT_EQ(11544, buffer[0]);
146 EXPECT_EQ(22377, buffer[4]); 147 EXPECT_EQ(22377, buffer[4]);
147 EXPECT_EQ(16389, buffer[7]); 148 EXPECT_EQ(16389, buffer[7]);
148 EXPECT_EQ(17631, buffer[kBufferLength - 1]); 149 EXPECT_EQ(17631, buffer[kBufferLength - 1]);
149 } 150 }
150 151
151 TEST_F(TransientFileUtilsTest, ReadInt16FromFileToFloatBuffer) { 152 TEST_F(TransientFileUtilsTest,
153 DISABLED_ON_IOS(ReadInt16FromFileToFloatBuffer)) {
152 std::string test_filename = kTestFileName; 154 std::string test_filename = kTestFileName;
153 155
154 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 156 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
155 157
156 file->OpenFile(test_filename.c_str(), 158 file->OpenFile(test_filename.c_str(),
157 true, // Read only. 159 true, // Read only.
158 true, // Loop. 160 true, // Loop.
159 false); // No text. 161 false); // No text.
160 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 162 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
161 << kTestFileName.c_str(); 163 << kTestFileName.c_str();
(...skipping 20 matching lines...) Expand all
182 EXPECT_EQ(kBufferLength, 184 EXPECT_EQ(kBufferLength,
183 ReadInt16FromFileToFloatBuffer(file.get(), 185 ReadInt16FromFileToFloatBuffer(file.get(),
184 kBufferLenghtLargerThanFile, 186 kBufferLenghtLargerThanFile,
185 buffer.get())); 187 buffer.get()));
186 EXPECT_DOUBLE_EQ(11544, buffer[0]); 188 EXPECT_DOUBLE_EQ(11544, buffer[0]);
187 EXPECT_DOUBLE_EQ(22377, buffer[4]); 189 EXPECT_DOUBLE_EQ(22377, buffer[4]);
188 EXPECT_DOUBLE_EQ(16389, buffer[7]); 190 EXPECT_DOUBLE_EQ(16389, buffer[7]);
189 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]); 191 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]);
190 } 192 }
191 193
192 TEST_F(TransientFileUtilsTest, ReadInt16FromFileToDoubleBuffer) { 194 TEST_F(TransientFileUtilsTest,
195 DISABLED_ON_IOS(ReadInt16FromFileToDoubleBuffer)) {
193 std::string test_filename = kTestFileName; 196 std::string test_filename = kTestFileName;
194 197
195 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 198 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
196 199
197 file->OpenFile(test_filename.c_str(), 200 file->OpenFile(test_filename.c_str(),
198 true, // Read only. 201 true, // Read only.
199 true, // Loop. 202 true, // Loop.
200 false); // No text. 203 false); // No text.
201 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 204 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
202 << kTestFileName.c_str(); 205 << kTestFileName.c_str();
(...skipping 19 matching lines...) Expand all
222 EXPECT_EQ(kBufferLength, 225 EXPECT_EQ(kBufferLength,
223 ReadInt16FromFileToDoubleBuffer(file.get(), 226 ReadInt16FromFileToDoubleBuffer(file.get(),
224 kBufferLenghtLargerThanFile, 227 kBufferLenghtLargerThanFile,
225 buffer.get())); 228 buffer.get()));
226 EXPECT_DOUBLE_EQ(11544, buffer[0]); 229 EXPECT_DOUBLE_EQ(11544, buffer[0]);
227 EXPECT_DOUBLE_EQ(22377, buffer[4]); 230 EXPECT_DOUBLE_EQ(22377, buffer[4]);
228 EXPECT_DOUBLE_EQ(16389, buffer[7]); 231 EXPECT_DOUBLE_EQ(16389, buffer[7]);
229 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]); 232 EXPECT_DOUBLE_EQ(17631, buffer[kBufferLength - 1]);
230 } 233 }
231 234
232 TEST_F(TransientFileUtilsTest, ReadFloatBufferFromFile) { 235 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadFloatBufferFromFile)) {
233 std::string test_filename = kTestFileNamef; 236 std::string test_filename = kTestFileNamef;
234 237
235 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 238 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
236 239
237 file->OpenFile(test_filename.c_str(), 240 file->OpenFile(test_filename.c_str(),
238 true, // Read only. 241 true, // Read only.
239 true, // Loop. 242 true, // Loop.
240 false); // No text. 243 false); // No text.
241 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 244 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
242 << kTestFileNamef.c_str(); 245 << kTestFileNamef.c_str();
(...skipping 16 matching lines...) Expand all
259 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2; 262 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
260 buffer.reset(new float[kBufferLenghtLargerThanFile]); 263 buffer.reset(new float[kBufferLenghtLargerThanFile]);
261 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(), 264 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
262 kBufferLenghtLargerThanFile, 265 kBufferLenghtLargerThanFile,
263 buffer.get())); 266 buffer.get()));
264 EXPECT_FLOAT_EQ(kPi, buffer[0]); 267 EXPECT_FLOAT_EQ(kPi, buffer[0]);
265 EXPECT_FLOAT_EQ(kE, buffer[1]); 268 EXPECT_FLOAT_EQ(kE, buffer[1]);
266 EXPECT_FLOAT_EQ(kAvogadro, buffer[2]); 269 EXPECT_FLOAT_EQ(kAvogadro, buffer[2]);
267 } 270 }
268 271
269 TEST_F(TransientFileUtilsTest, ReadDoubleBufferFromFile) { 272 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ReadDoubleBufferFromFile)) {
270 std::string test_filename = kTestFileName; 273 std::string test_filename = kTestFileName;
271 274
272 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 275 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
273 276
274 file->OpenFile(test_filename.c_str(), 277 file->OpenFile(test_filename.c_str(),
275 true, // Read only. 278 true, // Read only.
276 true, // Loop. 279 true, // Loop.
277 false); // No text. 280 false); // No text.
278 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 281 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
279 << kTestFileName.c_str(); 282 << kTestFileName.c_str();
(...skipping 16 matching lines...) Expand all
296 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2; 299 const size_t kBufferLenghtLargerThanFile = kBufferLength * 2;
297 buffer.reset(new double[kBufferLenghtLargerThanFile]); 300 buffer.reset(new double[kBufferLenghtLargerThanFile]);
298 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(), 301 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
299 kBufferLenghtLargerThanFile, 302 kBufferLenghtLargerThanFile,
300 buffer.get())); 303 buffer.get()));
301 EXPECT_DOUBLE_EQ(kPi, buffer[0]); 304 EXPECT_DOUBLE_EQ(kPi, buffer[0]);
302 EXPECT_DOUBLE_EQ(kE, buffer[1]); 305 EXPECT_DOUBLE_EQ(kE, buffer[1]);
303 EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]); 306 EXPECT_DOUBLE_EQ(kAvogadro, buffer[2]);
304 } 307 }
305 308
306 TEST_F(TransientFileUtilsTest, WriteInt16BufferToFile) { 309 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteInt16BufferToFile)) {
307 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 310 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
308 311
309 std::string kOutFileName = test::TempFilename(test::OutputPath(), 312 std::string kOutFileName = test::TempFilename(test::OutputPath(),
310 "utils_test"); 313 "utils_test");
311 314
312 file->OpenFile(kOutFileName.c_str(), 315 file->OpenFile(kOutFileName.c_str(),
313 false, // Write mode. 316 false, // Write mode.
314 false, // No loop. 317 false, // No loop.
315 false); // No text. 318 false); // No text.
316 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 319 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
338 << kOutFileName.c_str(); 341 << kOutFileName.c_str();
339 342
340 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(), 343 EXPECT_EQ(kBufferLength, ReadInt16BufferFromFile(file.get(),
341 kBufferLength, 344 kBufferLength,
342 read_buffer.get())); 345 read_buffer.get()));
343 EXPECT_EQ(0, memcmp(written_buffer.get(), 346 EXPECT_EQ(0, memcmp(written_buffer.get(),
344 read_buffer.get(), 347 read_buffer.get(),
345 kBufferLength * sizeof(written_buffer[0]))); 348 kBufferLength * sizeof(written_buffer[0])));
346 } 349 }
347 350
348 TEST_F(TransientFileUtilsTest, WriteFloatBufferToFile) { 351 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteFloatBufferToFile)) {
349 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 352 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
350 353
351 std::string kOutFileName = test::TempFilename(test::OutputPath(), 354 std::string kOutFileName = test::TempFilename(test::OutputPath(),
352 "utils_test"); 355 "utils_test");
353 356
354 file->OpenFile(kOutFileName.c_str(), 357 file->OpenFile(kOutFileName.c_str(),
355 false, // Write mode. 358 false, // Write mode.
356 false, // No loop. 359 false, // No loop.
357 false); // No text. 360 false); // No text.
358 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 361 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
380 << kOutFileName.c_str(); 383 << kOutFileName.c_str();
381 384
382 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(), 385 EXPECT_EQ(kBufferLength, ReadFloatBufferFromFile(file.get(),
383 kBufferLength, 386 kBufferLength,
384 read_buffer.get())); 387 read_buffer.get()));
385 EXPECT_EQ(0, memcmp(written_buffer.get(), 388 EXPECT_EQ(0, memcmp(written_buffer.get(),
386 read_buffer.get(), 389 read_buffer.get(),
387 kBufferLength * sizeof(written_buffer[0]))); 390 kBufferLength * sizeof(written_buffer[0])));
388 } 391 }
389 392
390 TEST_F(TransientFileUtilsTest, WriteDoubleBufferToFile) { 393 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(WriteDoubleBufferToFile)) {
391 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 394 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
392 395
393 std::string kOutFileName = test::TempFilename(test::OutputPath(), 396 std::string kOutFileName = test::TempFilename(test::OutputPath(),
394 "utils_test"); 397 "utils_test");
395 398
396 file->OpenFile(kOutFileName.c_str(), 399 file->OpenFile(kOutFileName.c_str(),
397 false, // Write mode. 400 false, // Write mode.
398 false, // No loop. 401 false, // No loop.
399 false); // No text. 402 false); // No text.
400 ASSERT_TRUE(file->Open()) << "File could not be opened:\n" 403 ASSERT_TRUE(file->Open()) << "File could not be opened:\n"
(...skipping 21 matching lines...) Expand all
422 << kOutFileName.c_str(); 425 << kOutFileName.c_str();
423 426
424 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(), 427 EXPECT_EQ(kBufferLength, ReadDoubleBufferFromFile(file.get(),
425 kBufferLength, 428 kBufferLength,
426 read_buffer.get())); 429 read_buffer.get()));
427 EXPECT_EQ(0, memcmp(written_buffer.get(), 430 EXPECT_EQ(0, memcmp(written_buffer.get(),
428 read_buffer.get(), 431 read_buffer.get(),
429 kBufferLength * sizeof(written_buffer[0]))); 432 kBufferLength * sizeof(written_buffer[0])));
430 } 433 }
431 434
432 TEST_F(TransientFileUtilsTest, ExpectedErrorReturnValues) { 435 TEST_F(TransientFileUtilsTest, DISABLED_ON_IOS(ExpectedErrorReturnValues)) {
433 std::string test_filename = kTestFileName; 436 std::string test_filename = kTestFileName;
434 437
435 double value; 438 double value;
436 rtc::scoped_ptr<int16_t[]> int16_buffer(new int16_t[1]); 439 rtc::scoped_ptr<int16_t[]> int16_buffer(new int16_t[1]);
437 rtc::scoped_ptr<double[]> double_buffer(new double[1]); 440 rtc::scoped_ptr<double[]> double_buffer(new double[1]);
438 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create()); 441 rtc::scoped_ptr<FileWrapper> file(FileWrapper::Create());
439 442
440 EXPECT_EQ(-1, ConvertByteArrayToDouble(NULL, &value)); 443 EXPECT_EQ(-1, ConvertByteArrayToDouble(NULL, &value));
441 EXPECT_EQ(-1, ConvertByteArrayToDouble(kPiBytes, NULL)); 444 EXPECT_EQ(-1, ConvertByteArrayToDouble(kPiBytes, NULL));
442 445
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 1, NULL)); 479 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 1, NULL));
477 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 0, int16_buffer.get())); 480 EXPECT_EQ(0u, WriteInt16BufferToFile(file.get(), 0, int16_buffer.get()));
478 481
479 EXPECT_EQ(0u, WriteDoubleBufferToFile(NULL, 1, double_buffer.get())); 482 EXPECT_EQ(0u, WriteDoubleBufferToFile(NULL, 1, double_buffer.get()));
480 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 1, NULL)); 483 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 1, NULL));
481 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 0, double_buffer.get())); 484 EXPECT_EQ(0u, WriteDoubleBufferToFile(file.get(), 0, double_buffer.get()));
482 } 485 }
483 486
484 } // namespace webrtc 487 } // namespace webrtc
485 488
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698