mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1217261 - Update mp4parse_rust gtest for api changes. r=kinetik.
Allocate an mp4parse_state struct and pass it through.
This commit is contained in:
parent
0749bfeb28
commit
26dd1892bd
@ -5,33 +5,46 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "mp4_demuxer/MP4Metadata.h"
|
||||
#include "mp4parse.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
extern "C" int32_t read_box_from_buffer(uint8_t *buffer, size_t size);
|
||||
|
||||
using namespace mp4_demuxer;
|
||||
using namespace mozilla;
|
||||
|
||||
TEST(rust, MP4MetadataEmpty)
|
||||
{
|
||||
int32_t rv;
|
||||
rv = read_box_from_buffer(nullptr, 0);
|
||||
|
||||
mp4parse_state* context = mp4parse_new();
|
||||
ASSERT_NE(context, nullptr);
|
||||
|
||||
rv = mp4parse_read(nullptr, nullptr, 0);
|
||||
EXPECT_EQ(rv, -1);
|
||||
rv = mp4parse_read(context, nullptr, 0);
|
||||
EXPECT_EQ(rv, -1);
|
||||
|
||||
size_t len = 4097;
|
||||
rv = read_box_from_buffer(nullptr, len);
|
||||
rv = mp4parse_read(nullptr, nullptr, len);
|
||||
EXPECT_EQ(rv, -1);
|
||||
rv = mp4parse_read(context, nullptr, len);
|
||||
EXPECT_EQ(rv, -1);
|
||||
|
||||
std::vector<uint8_t> buf;
|
||||
rv = read_box_from_buffer(buf.data(), buf.size());
|
||||
rv = mp4parse_read(nullptr, buf.data(), buf.size());
|
||||
EXPECT_EQ(rv, -1);
|
||||
rv = mp4parse_read(context, buf.data(), buf.size());
|
||||
EXPECT_EQ(rv, -1);
|
||||
|
||||
buf.reserve(len);
|
||||
rv = read_box_from_buffer(buf.data(), buf.size());
|
||||
rv = mp4parse_read(nullptr, buf.data(), buf.size());
|
||||
EXPECT_EQ(rv, -1);
|
||||
rv = mp4parse_read(context, buf.data(), buf.size());
|
||||
EXPECT_EQ(rv, -1);
|
||||
|
||||
mp4parse_free(context);
|
||||
}
|
||||
|
||||
TEST(rust, MP4Metadata)
|
||||
@ -45,6 +58,11 @@ TEST(rust, MP4Metadata)
|
||||
buf.resize(read);
|
||||
fclose(f);
|
||||
|
||||
int32_t rv = read_box_from_buffer(buf.data(), buf.size());
|
||||
mp4parse_state* context = mp4parse_new();
|
||||
ASSERT_NE(context, nullptr);
|
||||
|
||||
int32_t rv = mp4parse_read(context, buf.data(), buf.size());
|
||||
EXPECT_EQ(rv, 2);
|
||||
|
||||
mp4parse_free(context);
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ if CONFIG['MOZ_RUST']:
|
||||
TEST_HARNESS_FILES.gtest += [
|
||||
'../../../dom/media/test/street.mp4',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'../binding/include',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user