Bug 1224369 - p1: Test cases given as list - r=rillian
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 03 Dec 2015 14:14:46 +1100
changeset 309516 06c9e401ee3c3b62a4d488d17f56c1c592164e95
parent 309515 fcca1d97bd3263337b1cfba8891303651a51cd72
child 309517 6b7901d50318a6e485af823ef7fe9137daa618d9
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1224369
milestone45.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 1224369 - p1: Test cases given as list - r=rillian No actual test changes from before. This will help with this bug and future ones, to easily add more test cases.
dom/media/gtest/TestVPXDecoding.cpp
--- a/dom/media/gtest/TestVPXDecoding.cpp
+++ b/dom/media/gtest/TestVPXDecoding.cpp
@@ -61,30 +61,41 @@ ParseIVFConfig(nsTArray<uint8_t>& data, 
   vpx_codec_iface_t* codec = (data[10] == '8')
                              ? vpx_codec_vp8_dx()
                              : vpx_codec_vp9_dx();
   // Remove headers, to just leave raw VPx data to be decoded.
   data.RemoveElementsAt(0, 32 + 12);
   return codec;
 }
 
+struct TestFileData {
+  const char* mFilename;
+  vpx_codec_err_t mDecodeResult;
+};
+static const TestFileData testFiles[] = {
+  { "test_case_1224363.vp8.ivf", VPX_CODEC_CORRUPT_FRAME }
+};
+
 TEST(libvpx, test_case_1224363)
 {
-  nsTArray<uint8_t> data;
-  ReadVPXFile("test_case_1224363.vp8.ivf", data);
+  for (size_t test = 0; test < ArrayLength(testFiles); ++test) {
+    nsTArray<uint8_t> data;
+    ReadVPXFile(testFiles[test].mFilename, data);
+    ASSERT_GT(data.Length(), 0u);
 
-  vpx_codec_dec_cfg_t config;
-  vpx_codec_iface_t* dx = ParseIVFConfig(data, config);
-  ASSERT_TRUE(dx);
-  config.threads = 2;
+    vpx_codec_dec_cfg_t config;
+    vpx_codec_iface_t* dx = ParseIVFConfig(data, config);
+    ASSERT_TRUE(dx);
+    config.threads = 2;
 
-  vpx_codec_ctx_t ctx;
-  PodZero(&ctx);
-  vpx_codec_err_t r = vpx_codec_dec_init(&ctx, dx, &config, 0);
-  ASSERT_EQ(VPX_CODEC_OK, r);
+    vpx_codec_ctx_t ctx;
+    PodZero(&ctx);
+    vpx_codec_err_t r = vpx_codec_dec_init(&ctx, dx, &config, 0);
+    ASSERT_EQ(VPX_CODEC_OK, r);
 
-  r = vpx_codec_decode(&ctx, data.Elements(), data.Length(), nullptr, 0);
-  // This test case is known to be corrupt.
-  EXPECT_EQ(VPX_CODEC_CORRUPT_FRAME, r);
+    r = vpx_codec_decode(&ctx, data.Elements(), data.Length(), nullptr, 0);
+    // This test case is known to be corrupt.
+    EXPECT_EQ(testFiles[test].mDecodeResult, r);
 
-  r = vpx_codec_destroy(&ctx);
-  EXPECT_EQ(VPX_CODEC_OK, r);
+    r = vpx_codec_destroy(&ctx);
+    EXPECT_EQ(VPX_CODEC_OK, r);
+  }
 }