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

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

Issue 821453003: Update legacy Tuple-using code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 12 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // instantiated. 1021 // instantiated.
1022 // - Number of concurrent in-flight Decode() calls per decoder. 1022 // - Number of concurrent in-flight Decode() calls per decoder.
1023 // - Number of play-throughs. 1023 // - Number of play-throughs.
1024 // - reset_after_frame_num: see GLRenderingVDAClient ctor. 1024 // - reset_after_frame_num: see GLRenderingVDAClient ctor.
1025 // - delete_decoder_phase: see GLRenderingVDAClient ctor. 1025 // - delete_decoder_phase: see GLRenderingVDAClient ctor.
1026 // - whether to test slow rendering by delaying ReusePictureBuffer(). 1026 // - whether to test slow rendering by delaying ReusePictureBuffer().
1027 // - whether the video frames are rendered as thumbnails. 1027 // - whether the video frames are rendered as thumbnails.
1028 class VideoDecodeAcceleratorParamTest 1028 class VideoDecodeAcceleratorParamTest
1029 : public VideoDecodeAcceleratorTest, 1029 : public VideoDecodeAcceleratorTest,
1030 public ::testing::WithParamInterface< 1030 public ::testing::WithParamInterface<
1031 Tuple7<int, int, int, ResetPoint, ClientState, bool, bool> > { 1031 Tuple<int, int, int, ResetPoint, ClientState, bool, bool> > {
1032 }; 1032 };
1033 1033
1034 // Helper so that gtest failures emit a more readable version of the tuple than 1034 // Helper so that gtest failures emit a more readable version of the tuple than
1035 // its byte representation. 1035 // its byte representation.
1036 ::std::ostream& operator<<( 1036 ::std::ostream& operator<<(
1037 ::std::ostream& os, 1037 ::std::ostream& os,
1038 const Tuple7<int, int, int, ResetPoint, ClientState, bool, bool>& t) { 1038 const Tuple<int, int, int, ResetPoint, ClientState, bool, bool>& t) {
1039 return os << t.a << ", " << t.b << ", " << t.c << ", " << t.d << ", " << t.e 1039 return os << get<0>(t) << ", " << get<1>(t) << ", " << get<2>(t) << ", "
1040 << ", " << t.f << ", " << t.g; 1040 << get<3>(t) << ", " << get<4>(t) << ", " << get<5>(t) << ", "
1041 << get<6>(t);
1041 } 1042 }
1042 1043
1043 // Wait for |note| to report a state and if it's not |expected_state| then 1044 // Wait for |note| to report a state and if it's not |expected_state| then
1044 // assert |client| has deleted its decoder. 1045 // assert |client| has deleted its decoder.
1045 static void AssertWaitForStateOrDeleted( 1046 static void AssertWaitForStateOrDeleted(
1046 ClientStateNotification<ClientState>* note, 1047 ClientStateNotification<ClientState>* note,
1047 GLRenderingVDAClient* client, 1048 GLRenderingVDAClient* client,
1048 ClientState expected_state) { 1049 ClientState expected_state) {
1049 ClientState state = note->Wait(); 1050 ClientState state = note->Wait();
1050 if (state == expected_state) return; 1051 if (state == expected_state) return;
1051 ASSERT_TRUE(client->decoder_deleted()) 1052 ASSERT_TRUE(client->decoder_deleted())
1052 << "Decoder not deleted but Wait() returned " << state 1053 << "Decoder not deleted but Wait() returned " << state
1053 << ", instead of " << expected_state; 1054 << ", instead of " << expected_state;
1054 } 1055 }
1055 1056
1056 // We assert a minimal number of concurrent decoders we expect to succeed. 1057 // We assert a minimal number of concurrent decoders we expect to succeed.
1057 // Different platforms can support more concurrent decoders, so we don't assert 1058 // Different platforms can support more concurrent decoders, so we don't assert
1058 // failure above this. 1059 // failure above this.
1059 enum { kMinSupportedNumConcurrentDecoders = 3 }; 1060 enum { kMinSupportedNumConcurrentDecoders = 3 };
1060 1061
1061 // Test the most straightforward case possible: data is decoded from a single 1062 // Test the most straightforward case possible: data is decoded from a single
1062 // chunk and rendered to the screen. 1063 // chunk and rendered to the screen.
1063 TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { 1064 TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
1064 size_t num_concurrent_decoders = GetParam().a; 1065 size_t num_concurrent_decoders = get<0>(GetParam());
1065 const size_t num_in_flight_decodes = GetParam().b; 1066 const size_t num_in_flight_decodes = get<1>(GetParam());
1066 int num_play_throughs = GetParam().c; 1067 int num_play_throughs = get<2>(GetParam());
1067 const int reset_point = GetParam().d; 1068 const int reset_point = get<3>(GetParam());
1068 const int delete_decoder_state = GetParam().e; 1069 const int delete_decoder_state = get<4>(GetParam());
1069 bool test_reuse_delay = GetParam().f; 1070 bool test_reuse_delay = get<5>(GetParam());
1070 const bool render_as_thumbnails = GetParam().g; 1071 const bool render_as_thumbnails = get<6>(GetParam());
1071 1072
1072 if (test_video_files_.size() > 1) 1073 if (test_video_files_.size() > 1)
1073 num_concurrent_decoders = test_video_files_.size(); 1074 num_concurrent_decoders = test_video_files_.size();
1074 1075
1075 if (g_num_play_throughs > 0) 1076 if (g_num_play_throughs > 0)
1076 num_play_throughs = g_num_play_throughs; 1077 num_play_throughs = g_num_play_throughs;
1077 1078
1078 UpdateTestVideoFileParams( 1079 UpdateTestVideoFileParams(
1079 num_concurrent_decoders, reset_point, &test_video_files_); 1080 num_concurrent_decoders, reset_point, &test_video_files_);
1080 1081
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 if (it->first == "v" || it->first == "vmodule") 1460 if (it->first == "v" || it->first == "vmodule")
1460 continue; 1461 continue;
1461 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1462 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1462 } 1463 }
1463 1464
1464 base::ShadowingAtExitManager at_exit_manager; 1465 base::ShadowingAtExitManager at_exit_manager;
1465 content::RenderingHelper::InitializeOneOff(); 1466 content::RenderingHelper::InitializeOneOff();
1466 1467
1467 return RUN_ALL_TESTS(); 1468 return RUN_ALL_TESTS();
1468 } 1469 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698