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

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

Issue 1159553007: Move Tuple to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The bulk of this file is support code; sorry about that. Here's an overview 5 // The bulk of this file is support code; sorry about that. Here's an overview
6 // to hopefully help readers of this code: 6 // to hopefully help readers of this code:
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #if defined(USE_OZONE) 75 #if defined(USE_OZONE)
76 #include "ui/ozone/public/ozone_gpu_test_helper.h" 76 #include "ui/ozone/public/ozone_gpu_test_helper.h"
77 #include "ui/ozone/public/ozone_platform.h" 77 #include "ui/ozone/public/ozone_platform.h"
78 #endif // defined(USE_OZONE) 78 #endif // defined(USE_OZONE)
79 79
80 using media::VideoDecodeAccelerator; 80 using media::VideoDecodeAccelerator;
81 81
82 namespace content { 82 namespace content {
83 namespace { 83 namespace {
84 84
85 using base::MakeTuple;
86
85 // Values optionally filled in from flags; see main() below. 87 // Values optionally filled in from flags; see main() below.
86 // The syntax of multiple test videos is: 88 // The syntax of multiple test videos is:
87 // test-video1;test-video2;test-video3 89 // test-video1;test-video2;test-video3
88 // where only the first video is required and other optional videos would be 90 // where only the first video is required and other optional videos would be
89 // decoded by concurrent decoders. 91 // decoded by concurrent decoders.
90 // The syntax of each test-video is: 92 // The syntax of each test-video is:
91 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender 93 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender
92 // where only the first field is required. Value details: 94 // where only the first field is required. Value details:
93 // - |filename| must be an h264 Annex B (NAL) stream or an IVF VP8/9 stream. 95 // - |filename| must be an h264 Annex B (NAL) stream or an IVF VP8/9 stream.
94 // - |width| and |height| are in pixels. 96 // - |width| and |height| are in pixels.
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 // instantiated. 1172 // instantiated.
1171 // - Number of concurrent in-flight Decode() calls per decoder. 1173 // - Number of concurrent in-flight Decode() calls per decoder.
1172 // - Number of play-throughs. 1174 // - Number of play-throughs.
1173 // - reset_after_frame_num: see GLRenderingVDAClient ctor. 1175 // - reset_after_frame_num: see GLRenderingVDAClient ctor.
1174 // - delete_decoder_phase: see GLRenderingVDAClient ctor. 1176 // - delete_decoder_phase: see GLRenderingVDAClient ctor.
1175 // - whether to test slow rendering by delaying ReusePictureBuffer(). 1177 // - whether to test slow rendering by delaying ReusePictureBuffer().
1176 // - whether the video frames are rendered as thumbnails. 1178 // - whether the video frames are rendered as thumbnails.
1177 class VideoDecodeAcceleratorParamTest 1179 class VideoDecodeAcceleratorParamTest
1178 : public VideoDecodeAcceleratorTest, 1180 : public VideoDecodeAcceleratorTest,
1179 public ::testing::WithParamInterface< 1181 public ::testing::WithParamInterface<
1180 Tuple<int, int, int, ResetPoint, ClientState, bool, bool> > { 1182 base::Tuple<int, int, int, ResetPoint, ClientState, bool, bool> > {
1181 }; 1183 };
1182 1184
1183 // Helper so that gtest failures emit a more readable version of the tuple than 1185 // Helper so that gtest failures emit a more readable version of the tuple than
1184 // its byte representation. 1186 // its byte representation.
1185 ::std::ostream& operator<<( 1187 ::std::ostream& operator<<(
1186 ::std::ostream& os, 1188 ::std::ostream& os,
1187 const Tuple<int, int, int, ResetPoint, ClientState, bool, bool>& t) { 1189 const base::Tuple<int, int, int, ResetPoint, ClientState, bool, bool>& t) {
1188 return os << get<0>(t) << ", " << get<1>(t) << ", " << get<2>(t) << ", " 1190 return os << base::get<0>(t) << ", " << base::get<1>(t) << ", "
1189 << get<3>(t) << ", " << get<4>(t) << ", " << get<5>(t) << ", " 1191 << base::get<2>(t) << ", " << base::get<3>(t) << ", "
1190 << get<6>(t); 1192 << base::get<4>(t) << ", " << base::get<5>(t) << ", "
1193 << base::get<6>(t);
1191 } 1194 }
1192 1195
1193 // Wait for |note| to report a state and if it's not |expected_state| then 1196 // Wait for |note| to report a state and if it's not |expected_state| then
1194 // assert |client| has deleted its decoder. 1197 // assert |client| has deleted its decoder.
1195 static void AssertWaitForStateOrDeleted( 1198 static void AssertWaitForStateOrDeleted(
1196 ClientStateNotification<ClientState>* note, 1199 ClientStateNotification<ClientState>* note,
1197 GLRenderingVDAClient* client, 1200 GLRenderingVDAClient* client,
1198 ClientState expected_state) { 1201 ClientState expected_state) {
1199 ClientState state = note->Wait(); 1202 ClientState state = note->Wait();
1200 if (state == expected_state) return; 1203 if (state == expected_state) return;
1201 ASSERT_TRUE(client->decoder_deleted()) 1204 ASSERT_TRUE(client->decoder_deleted())
1202 << "Decoder not deleted but Wait() returned " << state 1205 << "Decoder not deleted but Wait() returned " << state
1203 << ", instead of " << expected_state; 1206 << ", instead of " << expected_state;
1204 } 1207 }
1205 1208
1206 // We assert a minimal number of concurrent decoders we expect to succeed. 1209 // We assert a minimal number of concurrent decoders we expect to succeed.
1207 // Different platforms can support more concurrent decoders, so we don't assert 1210 // Different platforms can support more concurrent decoders, so we don't assert
1208 // failure above this. 1211 // failure above this.
1209 enum { kMinSupportedNumConcurrentDecoders = 3 }; 1212 enum { kMinSupportedNumConcurrentDecoders = 3 };
1210 1213
1211 // Test the most straightforward case possible: data is decoded from a single 1214 // Test the most straightforward case possible: data is decoded from a single
1212 // chunk and rendered to the screen. 1215 // chunk and rendered to the screen.
1213 TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { 1216 TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
1214 size_t num_concurrent_decoders = get<0>(GetParam()); 1217 size_t num_concurrent_decoders = base::get<0>(GetParam());
1215 const size_t num_in_flight_decodes = get<1>(GetParam()); 1218 const size_t num_in_flight_decodes = base::get<1>(GetParam());
1216 int num_play_throughs = get<2>(GetParam()); 1219 int num_play_throughs = base::get<2>(GetParam());
1217 const int reset_point = get<3>(GetParam()); 1220 const int reset_point = base::get<3>(GetParam());
1218 const int delete_decoder_state = get<4>(GetParam()); 1221 const int delete_decoder_state = base::get<4>(GetParam());
1219 bool test_reuse_delay = get<5>(GetParam()); 1222 bool test_reuse_delay = base::get<5>(GetParam());
1220 const bool render_as_thumbnails = get<6>(GetParam()); 1223 const bool render_as_thumbnails = base::get<6>(GetParam());
1221 1224
1222 if (test_video_files_.size() > 1) 1225 if (test_video_files_.size() > 1)
1223 num_concurrent_decoders = test_video_files_.size(); 1226 num_concurrent_decoders = test_video_files_.size();
1224 1227
1225 if (g_num_play_throughs > 0) 1228 if (g_num_play_throughs > 0)
1226 num_play_throughs = g_num_play_throughs; 1229 num_play_throughs = g_num_play_throughs;
1227 1230
1228 UpdateTestVideoFileParams( 1231 UpdateTestVideoFileParams(
1229 num_concurrent_decoders, reset_point, &test_video_files_); 1232 num_concurrent_decoders, reset_point, &test_video_files_);
1230 1233
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 content::VaapiWrapper::PreSandboxInitialization(); 1640 content::VaapiWrapper::PreSandboxInitialization();
1638 #endif 1641 #endif
1639 1642
1640 content::g_env = 1643 content::g_env =
1641 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1644 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1642 testing::AddGlobalTestEnvironment( 1645 testing::AddGlobalTestEnvironment(
1643 new content::VideoDecodeAcceleratorTestEnvironment())); 1646 new content::VideoDecodeAcceleratorTestEnvironment()));
1644 1647
1645 return RUN_ALL_TESTS(); 1648 return RUN_ALL_TESTS();
1646 } 1649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698