summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 21:21:45 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 21:21:45 +0000
commit32bb0fe44eee4142b561b47355dcb820fdef198b (patch)
treee514d3198a86923f2aea048c7725b9cac5b70e68
parent484c530b3647e3760e266b5b1ff607079603f7dd (diff)
downloadchromium_src-32bb0fe44eee4142b561b47355dcb820fdef198b.zip
chromium_src-32bb0fe44eee4142b561b47355dcb820fdef198b.tar.gz
chromium_src-32bb0fe44eee4142b561b47355dcb820fdef198b.tar.bz2
Simple unit tests for OpenMAX video decoder
Added two simple test cases for OpenMAX video decoder. One does init and deinit of OpenMAX. The other one enumerate available components of video_decoder role. Review URL: http://codereview.chromium.org/524044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36170 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/omx/omx_unittest.cc39
-rw-r--r--third_party/openmax/omx_stub.cc8
2 files changed, 43 insertions, 4 deletions
diff --git a/media/omx/omx_unittest.cc b/media/omx/omx_unittest.cc
index d70aef6..76d8f14 100644
--- a/media/omx/omx_unittest.cc
+++ b/media/omx/omx_unittest.cc
@@ -1,13 +1,46 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009-2010 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 "base/logging.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/openmax/il/OMX_Component.h"
+#include "third_party/openmax/il/OMX_Core.h"
namespace media {
-TEST(OmxTest, Pass) {
- // TODO(scherkus): fill in with some sample OpenMAX tests.
+TEST(OmxTest, SimpleInit) {
+ EXPECT_EQ(OMX_ErrorNone, OMX_Init());
+ EXPECT_EQ(OMX_ErrorNone, OMX_Deinit());
+}
+
+TEST(OmxTest, GetComponentsOfRole) {
+ OMX_U32 roles = 0;
+ OMX_U8** component_names = NULL;
+ char role[] = "video_decoder";
+ const int kSize = 256;
+
+ EXPECT_EQ(OMX_ErrorNone, OMX_Init());
+ EXPECT_EQ(OMX_ErrorNone, OMX_GetComponentsOfRole(role, &roles, 0));
+
+ // TODO(hclam): Should assert the component number.
+ LOG(INFO) << "Video decoder components: " << roles;
+
+ if (roles) {
+ component_names = new OMX_U8*[roles];
+ for (size_t i = 0; i < roles; ++i)
+ component_names[i] = new OMX_U8[kSize];
+
+ OMX_U32 roles_backup = roles;
+ EXPECT_EQ(OMX_ErrorNone,
+ OMX_GetComponentsOfRole(role, &roles, component_names));
+ ASSERT_EQ(roles_backup, roles);
+
+ for (size_t i = 0; i < roles; ++i)
+ delete [] component_names[i];
+ delete [] component_names;
+ }
+ EXPECT_EQ(OMX_ErrorNone, OMX_Deinit());
}
} // namespace media
diff --git a/third_party/openmax/omx_stub.cc b/third_party/openmax/omx_stub.cc
index a2a7526..6da8e7b 100644
--- a/third_party/openmax/omx_stub.cc
+++ b/third_party/openmax/omx_stub.cc
@@ -31,6 +31,12 @@ OMX_API OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE*, OMX_STRING, OMX_PTR,
OMX_API OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE) {
NOTIMPLEMENTED();
return OMX_ErrorNotImplemented;
-};
+}
+
+OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole(OMX_STRING, OMX_U32*,
+ OMX_U8**) {
+ NOTIMPLEMENTED();
+ return OMX_ErrorNotImplemented;
+}
} // extern "C"