Flutter Engine
time_point_unittest.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/fml/time/chrono_timestamp_provider.h"
6 
7 #include "flutter/fml/time/dart_timestamp_provider.h"
8 
9 #include <thread>
10 
11 #include "gtest/gtest.h"
12 
13 namespace fml {
14 namespace {
15 
16 TEST(TimePoint, Control) {
17  EXPECT_LT(TimePoint::Min(), ChronoTicksSinceEpoch());
18  EXPECT_GT(TimePoint::Max(), ChronoTicksSinceEpoch());
19 }
20 
21 TEST(TimePoint, DartClockIsMonotonic) {
22  using namespace std::chrono_literals;
23  const auto t1 = DartTimelineTicksSinceEpoch();
24  std::this_thread::sleep_for(1us);
25  const auto t2 = DartTimelineTicksSinceEpoch();
26  std::this_thread::sleep_for(1us);
27  const auto t3 = DartTimelineTicksSinceEpoch();
28  EXPECT_LT(TimePoint::Min(), t1);
29  EXPECT_LE(t1, t2);
30  EXPECT_LE(t2, t3);
31  EXPECT_LT(t3, TimePoint::Max());
32 }
33 
34 } // namespace
35 } // namespace fml
static constexpr TimePoint Min()
Definition: time_point.h:30
Definition: ascii_trie.cc:9
static constexpr TimePoint Max()
Definition: time_point.h:34
fml::TimePoint ChronoTicksSinceEpoch()
fml::TimePoint DartTimelineTicksSinceEpoch()
TEST(MallocMapping, EmptyContructor)