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

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc

Issue 59883020: [NaCl SDK] nacl_io: Enable isatty running under sel_ldr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 EXPECT_EQ(access_time, statbuf.st_atime); 357 EXPECT_EQ(access_time, statbuf.st_atime);
358 EXPECT_EQ(creation_time, statbuf.st_ctime); 358 EXPECT_EQ(creation_time, statbuf.st_ctime);
359 EXPECT_EQ(modified_time, statbuf.st_mtime); 359 EXPECT_EQ(modified_time, statbuf.st_mtime);
360 360
361 // Test Get* and Isa* methods. 361 // Test Get* and Isa* methods.
362 size_t size; 362 size_t size;
363 EXPECT_EQ(0, node->GetSize(&size)); 363 EXPECT_EQ(0, node->GetSize(&size));
364 EXPECT_EQ(strlen(contents), size); 364 EXPECT_EQ(strlen(contents), size);
365 EXPECT_FALSE(node->IsaDir()); 365 EXPECT_FALSE(node->IsaDir());
366 EXPECT_TRUE(node->IsaFile()); 366 EXPECT_TRUE(node->IsaFile());
367 EXPECT_FALSE(node->IsaTTY()); 367 EXPECT_EQ(ENOTTY, node->Isatty());
368 368
369 // GetStat on a directory... 369 // GetStat on a directory...
370 EXPECT_EQ(0, fs->Open(Path("/dir"), O_RDONLY, &node)); 370 EXPECT_EQ(0, fs->Open(Path("/dir"), O_RDONLY, &node));
371 EXPECT_EQ(0, node->GetStat(&statbuf)); 371 EXPECT_EQ(0, node->GetStat(&statbuf));
372 EXPECT_EQ(S_IFDIR, statbuf.st_mode & S_IFMT); 372 EXPECT_EQ(S_IFDIR, statbuf.st_mode & S_IFMT);
373 EXPECT_EQ(S_IRUSR | S_IRGRP | S_IROTH | 373 EXPECT_EQ(S_IRUSR | S_IRGRP | S_IROTH |
374 S_IWUSR | S_IWGRP | S_IWOTH, statbuf.st_mode & ~S_IFMT); 374 S_IWUSR | S_IWGRP | S_IWOTH, statbuf.st_mode & ~S_IFMT);
375 EXPECT_EQ(0, statbuf.st_size); 375 EXPECT_EQ(0, statbuf.st_size);
376 EXPECT_EQ(access_time, statbuf.st_atime); 376 EXPECT_EQ(access_time, statbuf.st_atime);
377 EXPECT_EQ(creation_time, statbuf.st_ctime); 377 EXPECT_EQ(creation_time, statbuf.st_ctime);
378 EXPECT_EQ(modified_time, statbuf.st_mtime); 378 EXPECT_EQ(modified_time, statbuf.st_mtime);
379 379
380 // Test Get* and Isa* methods. 380 // Test Get* and Isa* methods.
381 EXPECT_EQ(0, node->GetSize(&size)); 381 EXPECT_EQ(0, node->GetSize(&size));
382 EXPECT_EQ(0, size); 382 EXPECT_EQ(0, size);
383 EXPECT_TRUE(node->IsaDir()); 383 EXPECT_TRUE(node->IsaDir());
384 EXPECT_FALSE(node->IsaFile()); 384 EXPECT_FALSE(node->IsaFile());
385 EXPECT_FALSE(node->IsaTTY()); 385 EXPECT_EQ(ENOTTY, node->Isatty());
386 } 386 }
387 387
388 TEST_F(Html5FsTest, FTruncate) { 388 TEST_F(Html5FsTest, FTruncate) {
389 const char contents[] = "contents"; 389 const char contents[] = "contents";
390 EXPECT_TRUE( 390 EXPECT_TRUE(
391 ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL)); 391 ppapi_html5_.filesystem_template()->AddFile("/file", contents, NULL));
392 EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL)); 392 EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddDirectory("/dir", NULL));
393 393
394 StringMap_t map; 394 StringMap_t map;
395 ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_)); 395 ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 EXPECT_EQ(sizeof(dirent), dirents[i].d_reclen); 486 EXPECT_EQ(sizeof(dirent), dirents[i].d_reclen);
487 dirnames.insert(dirents[i].d_name); 487 dirnames.insert(dirents[i].d_name);
488 } 488 }
489 489
490 EXPECT_EQ(1, dirnames.count("file")); 490 EXPECT_EQ(1, dirnames.count("file"));
491 EXPECT_EQ(1, dirnames.count("file2")); 491 EXPECT_EQ(1, dirnames.count("file2"));
492 EXPECT_EQ(1, dirnames.count(".")); 492 EXPECT_EQ(1, dirnames.count("."));
493 EXPECT_EQ(1, dirnames.count("..")); 493 EXPECT_EQ(1, dirnames.count(".."));
494 } 494 }
495 } 495 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/syscalls/isatty.c ('k') | native_client_sdk/src/tests/nacl_io_test/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698