Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc

Issue 1388413005: Move //mojo/services/X/public/... to //mojo/services/X/... (part 1). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
diff --git a/mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc b/mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
deleted file mode 100644
index f170326d45f53c5b2ac821d6ddc0231a4e5e9bf1..0000000000000000000000000000000000000000
--- a/mojo/services/files/public/c/tests/mojio_sys_stat_unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2015 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.
-
-// Basic tests of things declared in mojio_sys_stat.h. Note that more thorough
-// tests are done more directly at a different level.
-
-#include <errno.h>
-#include <string.h>
-
-#include "files/public/c/mojio_fcntl.h"
-#include "files/public/c/mojio_sys_stat.h"
-#include "files/public/c/mojio_unistd.h"
-#include "files/public/c/tests/mojio_test_base.h"
-
-namespace {
-
-using MojioSysStatTest = mojio::test::MojioTestBase;
-
-TEST_F(MojioSysStatTest, Fstat) {
- const char kTestData[511] = {};
-
- int fd = mojio_creat("my_file", MOJIO_S_IRWXU);
- EXPECT_GE(fd, 0);
-
- errno = 12345;
- struct mojio_stat buf = {};
- int result = mojio_fstat(fd, &buf);
- int errno_value = errno;
- EXPECT_EQ(0, result);
- EXPECT_EQ(12345, errno_value);
- // Note: Don't check the unfilled values. (Some of the checks may also be
- // fragile, depending on our level of support.)
- EXPECT_EQ(static_cast<mojio_mode_t>(MOJIO_S_IRWXU | MOJIO_S_IFREG),
- buf.st_mode); // Fragile.
- EXPECT_EQ(1u, buf.st_nlink); // Fragile.
- EXPECT_EQ(0, buf.st_size);
- // Just check that |st_atim.tv_sec|, etc. are positive (a bit fragile).
- EXPECT_GT(buf.st_atim.tv_sec, 0);
- EXPECT_GT(buf.st_mtim.tv_sec, 0);
- EXPECT_GT(buf.st_ctim.tv_sec, 0);
- EXPECT_EQ(1024, buf.st_blksize); // Fragile.
- EXPECT_EQ(0u, buf.st_blocks);
-
- // We use various assumptions below about the amount that we write, so we may
- // as well assert this here.
- static_assert(sizeof(kTestData) == 511, "oops");
- EXPECT_EQ(511, mojio_write(fd, kTestData, 511));
-
- memset(&buf, 0, sizeof(buf));
- EXPECT_EQ(0, mojio_fstat(fd, &buf));
- EXPECT_EQ(511, buf.st_size);
- EXPECT_EQ(1u, buf.st_blocks);
-
- EXPECT_EQ(511, mojio_write(fd, kTestData, 511));
-
- memset(&buf, 0, sizeof(buf));
- EXPECT_EQ(0, mojio_fstat(fd, &buf));
- EXPECT_EQ(1022, buf.st_size);
- EXPECT_EQ(2u, buf.st_blocks);
-
- EXPECT_EQ(0, mojio_close(fd));
-}
-
-TEST_F(MojioSysStatTest, Ebadf) {
- struct mojio_stat buf = {};
- errno = 12345;
- int result = mojio_fstat(-1, &buf);
- int errno_value = errno;
- EXPECT_EQ(-1, result);
- EXPECT_EQ(EBADF, errno_value);
-}
-
-} // namespace
« no previous file with comments | « mojo/services/files/public/c/tests/mojio_impl_test_base.cc ('k') | mojo/services/files/public/c/tests/mojio_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698