summaryrefslogtreecommitdiff
path: root/common/utils_unittest.cc
diff options
context:
space:
mode:
authorchrome-bot <chrome-bot@chromium.org>2019-01-13 13:52:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-13 13:52:20 -0800
commitbacee4044e68cb5d7044e54fe8cfa87baf2960ba (patch)
treeadd5e4a6b9effaf558701198868fbe95c33961f1 /common/utils_unittest.cc
parentef13c92c549fee1a73118c32315e4472a5c4ffa3 (diff)
parent7438410328547d8f55b6555ebdcfd9768978fcb9 (diff)
Merge commit '7438410328547d8f55b6555ebdcfd9768978fcb9' into patch_branch
Change-Id: Idc4f0d63865479d4e3b85069270c6c21d52a747d
Diffstat (limited to 'common/utils_unittest.cc')
-rw-r--r--common/utils_unittest.cc41
1 files changed, 0 insertions, 41 deletions
diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc
index 3405b682..b30b2d2a 100644
--- a/common/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -287,47 +287,6 @@ TEST(UtilsTest, FormatTimeDeltaTest) {
"-1s");
}
-TEST(UtilsTest, TimeFromStructTimespecTest) {
- struct timespec ts;
-
- // Unix epoch (Thursday 00:00:00 UTC on Jan 1, 1970)
- ts = (struct timespec) {.tv_sec = 0, .tv_nsec = 0};
- EXPECT_EQ(base::Time::UnixEpoch(), utils::TimeFromStructTimespec(&ts));
-
- // 42 ms after the Unix billennium (Sunday 01:46:40 UTC on September 9, 2001)
- ts = (struct timespec) {.tv_sec = 1000 * 1000 * 1000,
- .tv_nsec = 42 * 1000 * 1000};
- base::Time::Exploded exploded = (base::Time::Exploded) {
- .year = 2001, .month = 9, .day_of_week = 0, .day_of_month = 9,
- .hour = 1, .minute = 46, .second = 40, .millisecond = 42};
- base::Time time;
- EXPECT_TRUE(base::Time::FromUTCExploded(exploded, &time));
- EXPECT_EQ(time, utils::TimeFromStructTimespec(&ts));
-}
-
-TEST(UtilsTest, DecodeAndStoreBase64String) {
- base::FilePath path;
-
- // Ensure we return false on empty strings or invalid base64.
- EXPECT_FALSE(utils::DecodeAndStoreBase64String("", &path));
- EXPECT_FALSE(utils::DecodeAndStoreBase64String("not valid base64", &path));
-
- // Pass known base64 and check that it matches. This string was generated
- // the following way:
- //
- // $ echo "Update Engine" | base64
- // VXBkYXRlIEVuZ2luZQo=
- EXPECT_TRUE(utils::DecodeAndStoreBase64String("VXBkYXRlIEVuZ2luZQo=",
- &path));
- ScopedPathUnlinker unlinker(path.value());
- string expected_contents = "Update Engine\n";
- string contents;
- EXPECT_TRUE(utils::ReadFile(path.value(), &contents));
- EXPECT_EQ(contents, expected_contents);
- EXPECT_EQ(static_cast<off_t>(expected_contents.size()),
- utils::FileSize(path.value()));
-}
-
TEST(UtilsTest, ConvertToOmahaInstallDate) {
// The Omaha Epoch starts at Jan 1, 2007 0:00 PST which is a
// Monday. In Unix time, this point in time is easily obtained via