| //Copyright 2025 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| use rust_gtest_interop::prelude::*; |
| |
| chromium::import! { |
| "//mojo/public/rust/system:ffi_bindings" as mojo_ffi; |
| "//mojo/public/rust/system/test_util"; |
| } |
| |
| // This file is meant to mimic the tests in |
| // //mojo/public/c/system/tests/core_unittest_pure_c.c. |
| // These tests are thus somewhat redundant, but useful for ensuring that we're |
| // wrapping certain C API functions in a sensible way. |
| #[gtest(RustSystemAPITestSuite, MojoTimeTicksTest)] |
| fn test_ticks() { |
| // FOR_RELEASE: Right now we're calling init_mojo on a per-test basis, but |
| // may be worth seeing if there's some way to do gtest setup/teardown in |
| // Rust. |
| |
| // get_time_ticks_now should increase monotonically. |
| let ticks = mojo_ffi::functions::MojoGetTimeTicksNow(); |
| assert_ne!(ticks, 0); |
| } |
| |
| // FOR_RELEASE: Fill out the remaining (relevant) tests from |
| // core_unittest_pure_c.c. |