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

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: fischman's and dmichael's review comments. 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/cpp/graphics_3d.h"
9 #include "ppapi/cpp/video_decoder.h"
10 #include "ppapi/tests/testing_instance.h"
11
12 REGISTER_TEST_CASE(VideoDecoder);
13
14 static const bool kAllowSoftwareFallback = true;
15
16 bool TestVideoDecoder::Init() {
17 video_decoder_interface_ = static_cast<const PPB_VideoDecoder_0_1*>(
18 pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE_0_1));
19 return video_decoder_interface_ && CheckTestingInterface();
20 }
21
22 void TestVideoDecoder::RunTests(const std::string& filter) {
23 RUN_CALLBACK_TEST(TestVideoDecoder, Create, filter);
24 }
25
26 std::string TestVideoDecoder::TestCreate() {
27 // Test that Initialize fails with a bad Graphics3D resource.
28 {
29 pp::VideoDecoder video_decoder(instance_);
30 ASSERT_FALSE(video_decoder.is_null());
31
32 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
33 pp::Graphics3D context; // null context
34 callback.WaitForResult(video_decoder.Initialize(context,
35 PP_VIDEOPROFILE_VP8MAIN,
36 kAllowSoftwareFallback,
37 callback.GetCallback()));
38 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
39 }
40 // Test that Initialize fails with a bad profile enum value.
41 {
42 pp::VideoDecoder video_decoder(instance_);
43 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
44 const int width = 16;
45 const int height = 16;
46 const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
47 PP_GRAPHICS3DATTRIB_HEIGHT, height,
48 PP_GRAPHICS3DATTRIB_NONE};
49 pp::Graphics3D context(instance_, attribs);
50 const PP_VideoProfile kInvalidProfile = static_cast<PP_VideoProfile>(-1);
51 callback.WaitForResult(video_decoder.Initialize(context,
52 kInvalidProfile,
53 kAllowSoftwareFallback,
54 callback.GetCallback()));
55 ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
56 }
57 // Test that Initialize succeeds when we allow software fallback to VP8.
58 // Accept PP_ERROR_NOTSUPPORTED since some platforms may not support VP8.
Ami GONE FROM CHROMIUM 2014/06/06 17:14:33 how's that? (all shipping chromes support VP8 exce
bbudge 2014/06/07 00:31:08 I did this because the Create success test was fai
59 {
60 pp::VideoDecoder video_decoder(instance_);
61 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
62 const int width = 16;
63 const int height = 16;
64 const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
65 PP_GRAPHICS3DATTRIB_HEIGHT, height,
66 PP_GRAPHICS3DATTRIB_NONE};
67 pp::Graphics3D context(instance_, attribs);
68 callback.WaitForResult(video_decoder.Initialize(context,
69 PP_VIDEOPROFILE_VP8MAIN,
70 kAllowSoftwareFallback,
71 callback.GetCallback()));
72 ASSERT_TRUE(callback.result() == PP_OK ||
73 callback.result() == PP_ERROR_NOTSUPPORTED);
74 }
75
76 PASS();
77 }
OLDNEW
« content/renderer/pepper/video_decoder_adapter.cc ('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