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

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

Issue 1133933002: Move //services/files/c -> //mojo/services/files/public/c. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove data dep Created 5 years, 7 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
« no previous file with comments | « services/files/c/tests/mojio_impl_test_base.cc ('k') | services/files/c/tests/mojio_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/files/c/tests/mojio_sys_stat_unittest.cc
diff --git a/services/files/c/tests/mojio_sys_stat_unittest.cc b/services/files/c/tests/mojio_sys_stat_unittest.cc
deleted file mode 100644
index c0573549d4c758534e5959ba1af974ae0dc215c5..0000000000000000000000000000000000000000
--- a/services/files/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 "services/files/c/mojio_fcntl.h"
-#include "services/files/c/mojio_sys_stat.h"
-#include "services/files/c/mojio_unistd.h"
-#include "services/files/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 | « services/files/c/tests/mojio_impl_test_base.cc ('k') | services/files/c/tests/mojio_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698