OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/cdm/ppapi/cdm_file_io_test.h" | 5 #include "media/cdm/ppapi/cdm_file_io_test.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 | 358 |
359 bool FileIOTest::MatchesResult(const TestStep& a, const TestStep& b) { | 359 bool FileIOTest::MatchesResult(const TestStep& a, const TestStep& b) { |
360 DCHECK(IsResult(a) && IsResult(b)); | 360 DCHECK(IsResult(a) && IsResult(b)); |
361 if (a.type != b.type || a.status != b.status) | 361 if (a.type != b.type || a.status != b.status) |
362 return false; | 362 return false; |
363 | 363 |
364 if (a.type != RESULT_READ || a.status != cdm::FileIOClient::kSuccess) | 364 if (a.type != RESULT_READ || a.status != cdm::FileIOClient::kSuccess) |
365 return true; | 365 return true; |
366 | 366 |
367 return (a.data_size == a.data_size && | 367 return (a.data_size == b.data_size && |
368 std::equal(a.data, a.data + a.data_size, b.data)); | 368 std::equal(a.data, a.data + a.data_size, b.data)); |
369 } | 369 } |
370 | 370 |
371 void FileIOTest::RunNextStep() { | 371 void FileIOTest::RunNextStep() { |
372 // Run all actions in the current action group. | 372 // Run all actions in the current action group. |
373 while (!test_steps_.empty()) { | 373 while (!test_steps_.empty()) { |
374 // Start to wait for test results when the next step is a test result. | 374 // Start to wait for test results when the next step is a test result. |
375 if (IsResult(test_steps_.front())) | 375 if (IsResult(test_steps_.front())) |
376 return; | 376 return; |
377 | 377 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 void FileIOTest::OnTestComplete(bool success) { | 445 void FileIOTest::OnTestComplete(bool success) { |
446 while (!file_io_stack_.empty()) { | 446 while (!file_io_stack_.empty()) { |
447 file_io_stack_.top()->Close(); | 447 file_io_stack_.top()->Close(); |
448 file_io_stack_.pop(); | 448 file_io_stack_.pop(); |
449 } | 449 } |
450 FILE_IO_DVLOG(3) << test_name_ << (success ? " PASSED" : " FAILED"); | 450 FILE_IO_DVLOG(3) << test_name_ << (success ? " PASSED" : " FAILED"); |
451 base::ResetAndReturn(&completion_cb_).Run(success); | 451 base::ResetAndReturn(&completion_cb_).Run(success); |
452 } | 452 } |
453 | 453 |
454 } // namespace media | 454 } // namespace media |
OLD | NEW |