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

Unified Diff: native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc

Issue 605513002: [NaCl SDK] nacl_io: Replace allocated ino with hash of path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 6 years, 3 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 | « native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
diff --git a/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
index fa774afd621691a3cf10d554cec6643a7df57ddc..417249720e9f957350feb856ae7d3783baeff407 100644
--- a/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
@@ -470,6 +470,10 @@ TEST_F(Html5FsTest, GetDents) {
ScopedNode node;
ASSERT_EQ(0, fs->Open(Path("/file"), O_RDWR, &node));
+ struct stat stat;
+ ASSERT_EQ(0, node->GetStat(&stat));
+ ino_t file1_ino = stat.st_ino;
+
// Should fail for regular files.
const size_t kMaxDirents = 5;
dirent dirents[kMaxDirents];
@@ -506,6 +510,11 @@ TEST_F(Html5FsTest, GetDents) {
// Add another file...
ASSERT_EQ(0, fs->Open(Path("/file2"), O_CREAT, &node));
+ ASSERT_EQ(0, node->GetStat(&stat));
+ ino_t file2_ino = stat.st_ino;
+
+ // These files SHOULD not hash to the same value but COULD.
+ EXPECT_NE(file1_ino, file2_ino);
// Read the root directory again.
memset(&dirents[0], 0, sizeof(dirents));
@@ -521,6 +530,13 @@ TEST_F(Html5FsTest, GetDents) {
EXPECT_EQ(sizeof(dirent), dirents[i].d_off);
EXPECT_EQ(sizeof(dirent), dirents[i].d_reclen);
dirnames.insert(dirents[i].d_name);
+
+ if (!strcmp(dirents[i].d_name, "file")) {
+ EXPECT_EQ(dirents[i].d_ino, file1_ino);
+ }
+ if (!strcmp(dirents[i].d_name, "file2")) {
+ EXPECT_EQ(dirents[i].d_ino, file2_ino);
+ }
}
EXPECT_EQ(1, dirnames.count("file"));
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698