Bug 1238420 - Update MP4Rust gtest for CAPI changes. r=kinetik.
authorRalph Giles <giles@mozilla.com>
Mon, 11 Jan 2016 11:26:00 +1300
changeset 280338 1ca581e5420d1cffe8a8e68cb302647fa131553c
parent 280337 b0192610a0e7aee0286e4b45c40fd4b3c357f0cd
child 280339 6dd565cb21a224657b2211efaea485ec8df7819c
push id70402
push usermgregan@mozilla.com
push dateSun, 17 Jan 2016 22:49:41 +0000
treeherdermozilla-inbound@33b4a7fd0c53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1238420
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1238420 - Update MP4Rust gtest for CAPI changes. r=kinetik. mp4parse_read() returns a variety of error codes now. Call mp4parse_get_track_count() to verify the number of parsed tracks.
media/libstagefright/gtest/TestMP4Rust.cpp
--- a/media/libstagefright/gtest/TestMP4Rust.cpp
+++ b/media/libstagefright/gtest/TestMP4Rust.cpp
@@ -17,37 +17,37 @@ using namespace mozilla;
 TEST(rust, MP4MetadataEmpty)
 {
   int32_t rv;
 
   mp4parse_state* context = mp4parse_new();
   ASSERT_NE(context, nullptr);
 
   rv = mp4parse_read(nullptr, nullptr, 0);
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
   rv = mp4parse_read(context, nullptr, 0);
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
 
   size_t len = 4097;
   rv = mp4parse_read(nullptr, nullptr, len);
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
   rv = mp4parse_read(context, nullptr, len);
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
 
   std::vector<uint8_t> buf;
   rv = mp4parse_read(nullptr, buf.data(), buf.size());
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
   rv = mp4parse_read(context, buf.data(), buf.size());
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
 
   buf.reserve(len);
   rv = mp4parse_read(nullptr, buf.data(), buf.size());
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
   rv = mp4parse_read(context, buf.data(), buf.size());
-  EXPECT_EQ(rv, -1);
+  EXPECT_EQ(rv, MP4PARSE_ERROR_BADARG);
 
   mp4parse_free(context);
 }
 
 TEST(rust, MP4Metadata)
 {
   FILE* f = fopen("street.mp4", "rb");
   ASSERT_TRUE(f != nullptr);
@@ -57,12 +57,15 @@ TEST(rust, MP4Metadata)
   size_t read = fread(buf.data(), sizeof(decltype(buf)::value_type), buf.size(), f);
   buf.resize(read);
   fclose(f);
 
   mp4parse_state* context = mp4parse_new();
   ASSERT_NE(context, nullptr);
 
   int32_t rv = mp4parse_read(context, buf.data(), buf.size());
-  EXPECT_EQ(rv, 2);
+  EXPECT_EQ(rv, MP4PARSE_OK);
+
+  uint32_t tracks = mp4parse_get_track_count(context);
+  EXPECT_EQ(tracks, 2U);
 
   mp4parse_free(context);
 }