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

Unified Diff: ppapi/tests/test_video_decoder.cc

Issue 1207043002: Introduce a client minimum picture pool size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved constant to shared header, validate min_picture_size now in resource proxy as well as host co… Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_video_decoder.h ('k') | ppapi/thunk/interfaces_ppb_public_dev_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_video_decoder.cc
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
index f396bda8e3fa2b70570967ece1d0b4285aa630ae..a6b1ce98b5669579853e46348a0c18205c93dd6a 100644
--- a/ppapi/tests/test_video_decoder.cc
+++ b/ppapi/tests/test_video_decoder.cc
@@ -9,18 +9,27 @@
#include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
#include "ppapi/tests/testing_instance.h"
+namespace {
+
+// The maximum number of pictures that the client can pass in for
+// min_picture_count, just as a sanity check on the argument.
+// This should match the value of kMaximumPictureCount in
+// video_decoder_resource.cc.
+const uint32_t kMaximumPictureCount = 100;
+
+} // namespace
+
REGISTER_TEST_CASE(VideoDecoder);
bool TestVideoDecoder::Init() {
- video_decoder_interface_ = static_cast<const PPB_VideoDecoder_0_1*>(
- pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE_0_1));
const int width = 16;
const int height = 16;
const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
PP_GRAPHICS3DATTRIB_HEIGHT, height,
PP_GRAPHICS3DATTRIB_NONE};
graphics_3d_ = pp::Graphics3D(instance_, attribs);
- return video_decoder_interface_ && CheckTestingInterface();
+ return (pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE) &&
+ CheckTestingInterface());
}
void TestVideoDecoder::RunTests(const std::string& filter) {
@@ -39,6 +48,7 @@ std::string TestVideoDecoder::TestCreate() {
video_decoder.Initialize(null_graphics_3d,
PP_VIDEOPROFILE_VP8_ANY,
PP_HARDWAREACCELERATION_WITHFALLBACK,
+ 0,
callback.GetCallback()));
ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
}
@@ -51,6 +61,7 @@ std::string TestVideoDecoder::TestCreate() {
video_decoder.Initialize(graphics_3d_,
kInvalidProfile,
PP_HARDWAREACCELERATION_WITHFALLBACK,
+ 0,
callback.GetCallback()));
ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
}
@@ -63,9 +74,37 @@ std::string TestVideoDecoder::TestCreate() {
video_decoder.Initialize(graphics_3d_,
PP_VIDEOPROFILE_VP8_ANY,
PP_HARDWAREACCELERATION_WITHFALLBACK,
+ 0,
callback.GetCallback()));
ASSERT_EQ(PP_OK, callback.result());
}
+ // Test that Initialize succeeds with a larger than normal number of requested
+ // picture buffers, if we can create a Graphics3D resource and if we allow
+ // software fallback to VP8, which should always be supported.
+ if (!graphics_3d_.is_null()) {
+ pp::VideoDecoder video_decoder(instance_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ video_decoder.Initialize(graphics_3d_,
+ PP_VIDEOPROFILE_VP8_ANY,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ kMaximumPictureCount,
+ callback.GetCallback()));
+ ASSERT_EQ(PP_OK, callback.result());
+ }
+ // Test that Initialize fails if we request an unreasonable number of picture
+ // buffers.
+ if (!graphics_3d_.is_null()) {
+ pp::VideoDecoder video_decoder(instance_);
+ TestCompletionCallback callback(instance_->pp_instance(), callback_type());
+ callback.WaitForResult(
+ video_decoder.Initialize(graphics_3d_,
+ PP_VIDEOPROFILE_VP8_ANY,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
+ kMaximumPictureCount + 1,
+ callback.GetCallback()));
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
+ }
PASS();
}
« no previous file with comments | « ppapi/tests/test_video_decoder.h ('k') | ppapi/thunk/interfaces_ppb_public_dev_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698