summaryrefslogtreecommitdiffstats
path: root/cc/proto/base_conversions_unittest.cc
blob: 57dd80763a85ec4b8da5302b7534a36c68a19585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2016 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 "cc/proto/base_conversions.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace cc {
namespace {

TEST(BaseProtoConversionsTest, SerializeTimeTicks) {
  base::TimeTicks ticks;
  base::TimeTicks new_ticks;

  ticks = base::TimeTicks::FromInternalValue(2);
  new_ticks = ProtoToTimeTicks(TimeTicksToProto(ticks));
  EXPECT_EQ(ticks, new_ticks);

  ticks = base::TimeTicks::Now();
  new_ticks = ProtoToTimeTicks(TimeTicksToProto(ticks));
  EXPECT_EQ(ticks, new_ticks);

  ticks = base::TimeTicks::FromInternalValue(0);
  new_ticks = ProtoToTimeTicks(TimeTicksToProto(ticks));
  EXPECT_EQ(ticks, new_ticks);
}

}  // namespace
}  // namespace cc