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

Side by Side Diff: content/common/gpu/media/video_encode_accelerator_unittest.cc

Issue 614893004: Refactor AppendToFile and WriteFileDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 6 years, 2 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
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder_unittest.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file_util.h" 8 #include "base/files/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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 const uint8* stream_ptr = static_cast<const uint8*>(shm->memory()); 819 const uint8* stream_ptr = static_cast<const uint8*>(shm->memory());
820 if (payload_size > 0) 820 if (payload_size > 0)
821 validator_->ProcessStreamBuffer(stream_ptr, payload_size); 821 validator_->ProcessStreamBuffer(stream_ptr, payload_size);
822 822
823 EXPECT_EQ(key_frame, seen_keyframe_in_this_buffer_); 823 EXPECT_EQ(key_frame, seen_keyframe_in_this_buffer_);
824 seen_keyframe_in_this_buffer_ = false; 824 seen_keyframe_in_this_buffer_ = false;
825 825
826 if (save_to_file_) { 826 if (save_to_file_) {
827 int size = base::checked_cast<int>(payload_size); 827 int size = base::checked_cast<int>(payload_size);
828 EXPECT_EQ(base::AppendToFile( 828 EXPECT_TRUE(base::AppendToFile(
829 base::FilePath::FromUTF8Unsafe(test_stream_->out_filename), 829 base::FilePath::FromUTF8Unsafe(test_stream_->out_filename),
830 static_cast<char*>(shm->memory()), 830 static_cast<char*>(shm->memory()),
831 size), 831 size));
832 size);
833 } 832 }
834 833
835 FeedEncoderWithOutput(shm); 834 FeedEncoderWithOutput(shm);
836 } 835 }
837 836
838 void VEAClient::NotifyError(VideoEncodeAccelerator::Error error) { 837 void VEAClient::NotifyError(VideoEncodeAccelerator::Error error) {
839 DCHECK(thread_checker_.CalledOnValidThread()); 838 DCHECK(thread_checker_.CalledOnValidThread());
840 SetState(CS_ERROR); 839 SetState(CS_ERROR);
841 } 840 }
842 841
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 } 1203 }
1205 1204
1206 content::g_env = 1205 content::g_env =
1207 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( 1206 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>(
1208 testing::AddGlobalTestEnvironment( 1207 testing::AddGlobalTestEnvironment(
1209 new content::VideoEncodeAcceleratorTestEnvironment( 1208 new content::VideoEncodeAcceleratorTestEnvironment(
1210 test_stream_data.Pass()))); 1209 test_stream_data.Pass())));
1211 1210
1212 return RUN_ALL_TESTS(); 1211 return RUN_ALL_TESTS();
1213 } 1212 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder_unittest.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698