0
Files
src/components/ntp_snippets/time_serialization_unittest.cc
Peter Kasting e5a38eddbd Migrate "base::TimeDelta::FromX" to "base:X".
All changes were done automatically with git grep, sed, xargs, etc.

No-Presubmit: true
No-Try: true
Bug: 1243777
Change-Id: I7cc197e9027f7837cd36afc67a209079f85ec364
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3198824
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927512}
2021-10-02 03:06:35 +00:00

26 lines
913 B
C++

// Copyright 2017 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 "components/ntp_snippets/time_serialization.h"
#include <vector>
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace ntp_snippets {
TEST(TimeSerializationTest, TimeSerialization) {
std::vector<base::Time> values_to_test = {base::Time::Min(), base::Time(),
base::Time() + base::Hours(1),
base::Time::Max()};
for (const base::Time& value : values_to_test) {
EXPECT_EQ(SerializeTime(value), value.ToInternalValue());
EXPECT_EQ(base::Time::FromInternalValue(SerializeTime(value)), value);
EXPECT_EQ(DeserializeTime(SerializeTime(value)), value);
}
}
} // namespace ntp_snippets