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

Side by Side Diff: base/files/protect_file_posix_unittest.cc

Issue 720753002: NOT_FOR_COMMIT: Death Test for intercepting base::File Open/Close Base URL: https://chromium.googlesource.com/chromium/src.git@cache-close
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « base/base.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #if defined(OS_POSIX)
6 #include <unistd.h>
7 #endif
8
9 #include "base/files/file.h"
10 #include "base/files/scoped_temp_dir.h"
11 #include "base/posix/eintr_wrapper.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace {
15
16 #if defined(OS_POSIX) && GTEST_HAS_DEATH_TEST
17
18 TEST(ProtectFilePosixDeathTest, CloseProtected) {
19 base::ScopedTempDir temp_dir;
20 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
21 base::FilePath file_path = temp_dir.path().AppendASCII("new_file");
22 base::File file(file_path,
23 base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ);
24 EXPECT_TRUE(file.IsValid());
25 int fd = file.GetPlatformFile();
26 EXPECT_DEATH(IGNORE_EINTR(close(fd)), "");
27 }
28
29 #endif // defined(OS_POSIX) && GTEST_HAS_DEATH_TEST
30
31 } // namespace
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698