mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-09 03:57:24 +00:00
This search/replace updates all copyright notices to drop the "All rights reserved", Use "ChromiumOS" instead of "Chromium OS" and drops the trailing dots. This fulfills the request from legal and unifies our notices. ./tools/health-check has been updated to only accept this style. BUG=b:246579983 TEST=./tools/health-check Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
58 lines
1.6 KiB
Rust
58 lines
1.6 KiB
Rust
// Copyright 2020 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
//! Integration tests using LibVDA fake decode implemenation.
|
|
|
|
use libvda::decode::*;
|
|
use libvda::*;
|
|
|
|
fn create_vda_instance() -> VdaInstance {
|
|
VdaInstance::new(VdaImplType::Fake).expect("failed to create VDAInstance")
|
|
}
|
|
|
|
#[test]
|
|
fn test_create_instance() {
|
|
let instance = create_vda_instance();
|
|
let caps = instance.get_capabilities();
|
|
|
|
assert_ne!(caps.input_formats.len(), 0);
|
|
assert_ne!(caps.output_formats.len(), 0);
|
|
}
|
|
|
|
#[test]
|
|
fn test_initialize_decode_session() {
|
|
let instance = create_vda_instance();
|
|
let _session = instance
|
|
.open_session(Profile::VP8)
|
|
.expect("failed to open a session for VP8");
|
|
}
|
|
|
|
#[test]
|
|
fn test_decode_and_get_picture_ready_fake() {
|
|
let instance = create_vda_instance();
|
|
let mut session = instance
|
|
.open_session(Profile::VP8)
|
|
.expect("failed to open a session");
|
|
|
|
// Call decode() with dummy arguments.
|
|
let fake_bitstream_id = 12345;
|
|
session
|
|
.decode(
|
|
fake_bitstream_id,
|
|
1, // fd
|
|
0, // offset
|
|
0, // bytes_used
|
|
)
|
|
.expect("failed to send a decode request");
|
|
|
|
// Since we are using the fake backend,
|
|
// we must get a event immediately after calling decode().
|
|
match session.read_event() {
|
|
Ok(Event::PictureReady { bitstream_id, .. }) => {
|
|
assert_eq!(bitstream_id, fake_bitstream_id);
|
|
}
|
|
Ok(event) => panic!("Obtained event is not PictureReady but {:?}", event),
|
|
Err(msg) => panic!("{}", msg),
|
|
}
|
|
}
|