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

Side by Side Diff: ppapi/tests/test_video_decoder.cc

Issue 311853005: Implement software fallback for PPB_VideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use WeakPtr to tie VideoDecoderProxy and Delegate. Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/tests/test_video_decoder.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_var.h"
dmichael (off chromium) 2014/06/05 23:00:43 nit: unused?
bbudge 2014/06/06 02:03:44 Done.
9 #include "ppapi/cpp/graphics_3d.h"
10 #include "ppapi/cpp/video_decoder.h"
11 #include "ppapi/tests/testing_instance.h"
12
13 REGISTER_TEST_CASE(VideoDecoder);
14
15 static const bool kAllowSoftwareFallback = true;
16
17 bool TestVideoDecoder::Init() {
18 video_decoder_interface_ = static_cast<const PPB_VideoDecoder_0_1*>(
19 pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE_0_1));
20 return video_decoder_interface_ && CheckTestingInterface();
21 }
22
23 void TestVideoDecoder::RunTests(const std::string& filter) {
24 RUN_CALLBACK_TEST(TestVideoDecoder, Create, filter);
25 }
26
27 void TestVideoDecoder::QuitMessageLoop() {
28 testing_interface_->QuitMessageLoop(instance_->pp_instance());
29 }
dmichael (off chromium) 2014/06/05 23:00:43 You don't seem to use this function
bbudge 2014/06/06 02:03:44 Done.
30
31 std::string TestVideoDecoder::TestCreate() {
32 // Test that Initialize fails with a bad Graphics3D resource.
33 {
34 pp::VideoDecoder video_decoder(instance_);
35 ASSERT_FALSE(video_decoder.is_null());
36
37 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
38 pp::Graphics3D context; // null context
39 callback.WaitForResult(video_decoder.Initialize(context,
40 PP_VIDEOPROFILE_VP8MAIN,
41 kAllowSoftwareFallback,
42 callback.GetCallback()));
43 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
44 }
45 // Test that Initialize fails with a bad profile enum value.
46 {
47 pp::VideoDecoder video_decoder(instance_);
48 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
49 const int width = 16;
50 const int height = 16;
51 const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
52 PP_GRAPHICS3DATTRIB_HEIGHT, height,
53 PP_GRAPHICS3DATTRIB_NONE};
54 pp::Graphics3D context(instance_, attribs);
55 const PP_VideoProfile kInvalidProfile = static_cast<PP_VideoProfile>(-1);
56 callback.WaitForResult(video_decoder.Initialize(context,
57 kInvalidProfile,
58 kAllowSoftwareFallback,
59 callback.GetCallback()));
60 ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
61 }
62 // Test that Initialize succeeds when we allow software fallback to VP8.
63 {
64 pp::VideoDecoder video_decoder(instance_);
65 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
66 const int width = 16;
67 const int height = 16;
68 const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
69 PP_GRAPHICS3DATTRIB_HEIGHT, height,
70 PP_GRAPHICS3DATTRIB_NONE};
71 pp::Graphics3D context(instance_, attribs);
72 callback.WaitForResult(video_decoder.Initialize(context,
73 PP_VIDEOPROFILE_VP8MAIN,
74 kAllowSoftwareFallback,
75 callback.GetCallback()));
76 ASSERT_TRUE(callback.result() == PP_OK);
77 }
78
79 PASS();
80 }
OLDNEW
« ppapi/tests/test_video_decoder.h ('K') | « ppapi/tests/test_video_decoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698