You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
38 lines
1.0 KiB
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "mojo/public/cpp/base/time_mojom_traits.h"
|
|
#include "mojo/public/cpp/test_support/test_utils.h"
|
|
#include "mojo/public/mojom/base/time.mojom.h"
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
namespace mojo_base {
|
|
namespace time_unittest {
|
|
|
|
TEST(TimeTest, Time) {
|
|
base::Time in = base::Time::Now();
|
|
base::Time out;
|
|
|
|
ASSERT_TRUE(mojo::test::SerializeAndDeserialize<mojom::Time>(&in, &out));
|
|
EXPECT_EQ(in, out);
|
|
}
|
|
|
|
TEST(TimeTest, TimeDelta) {
|
|
base::TimeDelta in = base::TimeDelta::FromDays(123);
|
|
base::TimeDelta out;
|
|
|
|
ASSERT_TRUE(mojo::test::SerializeAndDeserialize<mojom::TimeDelta>(&in, &out));
|
|
EXPECT_EQ(in, out);
|
|
}
|
|
|
|
TEST(TimeTest, TimeTicks) {
|
|
base::TimeTicks in = base::TimeTicks::Now();
|
|
base::TimeTicks out;
|
|
|
|
ASSERT_TRUE(mojo::test::SerializeAndDeserialize<mojom::TimeTicks>(&in, &out));
|
|
EXPECT_EQ(in, out);
|
|
}
|
|
|
|
} // namespace time_unittest
|
|
} // namespace mojo_base
|