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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // we'll be treating ourselves to random corruption. | 587 // we'll be treating ourselves to random corruption. |
588 // Since we are just mmapping and passing chunks of the input file, to ensure | 588 // Since we are just mmapping and passing chunks of the input file, to ensure |
589 // alignment, if the starting virtual addresses of the frames in it were not | 589 // alignment, if the starting virtual addresses of the frames in it were not |
590 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy | 590 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy |
591 // the frames into them before sending to the encoder. It would have been an | 591 // the frames into them before sending to the encoder. It would have been an |
592 // overkill here though, because, for now at least, we only test resolutions | 592 // overkill here though, because, for now at least, we only test resolutions |
593 // that result in proper alignment, and it would have also interfered with | 593 // that result in proper alignment, and it would have also interfered with |
594 // performance testing. So just assert that the frame size is a multiple of | 594 // performance testing. So just assert that the frame size is a multiple of |
595 // 64 bytes. This ensures all frames start at 64-byte boundary, because | 595 // 64 bytes. This ensures all frames start at 64-byte boundary, because |
596 // MemoryMappedFile should be mmapp()ed at virtual page start as well. | 596 // MemoryMappedFile should be mmapp()ed at virtual page start as well. |
597 ASSERT_EQ(input_buffer_size_ & 63, 0) | 597 ASSERT_EQ(input_buffer_size_ & 63, 0u) |
598 << "Frame size has to be a multiple of 64 bytes"; | 598 << "Frame size has to be a multiple of 64 bytes"; |
599 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0) | 599 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0) |
600 << "Mapped file should be mapped at a 64 byte boundary"; | 600 << "Mapped file should be mapped at a 64 byte boundary"; |
601 | 601 |
602 num_required_input_buffers_ = input_count; | 602 num_required_input_buffers_ = input_count; |
603 ASSERT_GT(num_required_input_buffers_, 0UL); | 603 ASSERT_GT(num_required_input_buffers_, 0UL); |
604 | 604 |
605 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_; | 605 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_; |
606 CHECK_GT(num_frames_in_stream_, 0UL); | 606 CHECK_GT(num_frames_in_stream_, 0UL); |
607 CHECK_LE(num_frames_in_stream_, kMaxFrameNum); | 607 CHECK_LE(num_frames_in_stream_, kMaxFrameNum); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 test_stream_data->assign(it->second.c_str()); | 1004 test_stream_data->assign(it->second.c_str()); |
1005 continue; | 1005 continue; |
1006 } | 1006 } |
1007 if (it->first == "v" || it->first == "vmodule") | 1007 if (it->first == "v" || it->first == "vmodule") |
1008 continue; | 1008 continue; |
1009 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1009 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1010 } | 1010 } |
1011 | 1011 |
1012 return RUN_ALL_TESTS(); | 1012 return RUN_ALL_TESTS(); |
1013 } | 1013 } |
OLD | NEW |