summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 22:53:39 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 22:53:39 +0000
commitef932ed16a50a6fa0adb801c32f3d4860e880bc9 (patch)
tree76ada28fef125550a957fc868d5cb2a4013b8f93 /ppapi/tests
parent5b8149fa24feeeab86de1b86ee1da6abe68165f4 (diff)
downloadchromium_src-ef932ed16a50a6fa0adb801c32f3d4860e880bc9.zip
chromium_src-ef932ed16a50a6fa0adb801c32f3d4860e880bc9.tar.gz
chromium_src-ef932ed16a50a6fa0adb801c32f3d4860e880bc9.tar.bz2
Draft version of the HW video decode tester and few other changes.
Intention is that this tester can be used to decouple HW decode accelerator integration from running the whole Chrome browser. Features: - Independent GUnit executable, which should be possible to use in autotests. - Mimics Renderer process from Gpu video pipeline perspective. * Test bench contains implementation of FakeClient which essentially mimics Renderer process from the GpuVideoDecodeAccelerator's point of view. * FakeClient runs on it's own thread and will communicate with using the IPC messages that are used also within the real use case. * FakeClient will allocate memories using same SharedMemory stuff as the real Renderer code. * Currently reads H.264 Annex B bitstream from file and parses it to NAL units before feeding to the decoder * TODO: Polish and improving the features and configurability. * TODO: GLES texture allocation for textures. - Allows building various test cases and error behaviour as well both on AcceleratedVideoDecoder interface as well as erroneous behaviour from the client. - Allows also checking expected order of calls if we want to enforce certain behaviour across various implementations. Patch by vmr@chromium.org: http://codereview.chromium.org/6720040/ BUG=none TEST=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81663 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_video_decoder.cc46
-rw-r--r--ppapi/tests/test_video_decoder.h34
2 files changed, 80 insertions, 0 deletions
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
new file mode 100644
index 0000000..f669d47
--- /dev/null
+++ b/ppapi/tests/test_video_decoder.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/tests/test_video_decoder.h"
+
+#include "ppapi/c/dev/ppb_video_decoder_dev.h"
+#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(VideoDecoder);
+
+bool TestVideoDecoder::Init() {
+ video_decoder_interface_ = reinterpret_cast<PPB_VideoDecoder_Dev const*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_DEV_INTERFACE));
+ var_interface_ = reinterpret_cast<PPB_Var const*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE));
+ testing_interface_ = reinterpret_cast<PPB_Testing_Dev const*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_TESTING_DEV_INTERFACE));
+ if (!testing_interface_) {
+ // Give a more helpful error message for the testing interface being gone
+ // since that needs special enabling in Chrome.
+ instance_->AppendError("This test needs the testing interface, which is "
+ "not currently available. In Chrome, use --enable-pepper-testing when "
+ "launching.");
+ }
+ return video_decoder_interface_ && var_interface_ && testing_interface_;
+}
+
+void TestVideoDecoder::RunTest() {
+ instance_->LogTest("Create", TestCreate());
+}
+
+void TestVideoDecoder::QuitMessageLoop() {
+ testing_interface_->QuitMessageLoop(instance_->pp_instance());
+}
+
+std::string TestVideoDecoder::TestCreate() {
+ PP_Resource decoder = video_decoder_interface_->Create(
+ instance_->pp_instance(), NULL);
+ if (decoder == 0) {
+ return "Error creating the decoder";
+ }
+ PASS();
+}
diff --git a/ppapi/tests/test_video_decoder.h b/ppapi/tests/test_video_decoder.h
new file mode 100644
index 0000000..7c852b7
--- /dev/null
+++ b/ppapi/tests/test_video_decoder.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_TESTS_TEST_VIDEO_DECODER_H_
+#define PPAPI_TESTS_TEST_VIDEO_DECODER_H_
+
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/tests/test_case.h"
+
+struct PPB_Testing_Dev;
+struct PPB_Var;
+struct PPB_VideoDecoder_Dev;
+
+class TestVideoDecoder : public TestCase {
+ public:
+ TestVideoDecoder(TestingInstance* instance) : TestCase(instance) {}
+
+ // TestCase implementation.
+ virtual bool Init();
+ virtual void RunTest();
+
+ void QuitMessageLoop();
+
+ private:
+ std::string TestCreate();
+
+ // Used by the tests that access the C API directly.
+ const PPB_VideoDecoder_Dev* video_decoder_interface_;
+ const PPB_Var* var_interface_;
+ const PPB_Testing_Dev* testing_interface_;
+};
+
+#endif // PPAPI_TESTS_TEST_VIDEO_DECODER_H_