Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
fml
platform
win
file_win_unittests.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter 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
#include "flutter/fml/file.h"
6
7
#include <Fileapi.h>
8
9
#include "flutter/fml/platform/win/wstring_conversion.h"
10
#include "gtest/gtest.h"
11
12
namespace
fml
{
13
namespace
testing {
14
15
TEST
(FileWin, OpenDirectoryShare) {
16
fml::ScopedTemporaryDirectory
temp_dir;
17
auto
temp_path =
Utf8ToWideString
({temp_dir.
path
()});
18
fml::UniqueFD
handle(
19
CreateFile
(temp_path.c_str(), GENERIC_WRITE,
20
FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr
, OPEN_EXISTING,
21
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
nullptr
));
22
ASSERT_TRUE(handle.is_valid());
23
24
// Check that fml::OpenDirectory(FilePermission::kRead) works with a
25
// directory that has also been opened for writing.
26
auto
dir =
fml::OpenDirectory
(temp_dir.
path
().c_str(),
false
,
27
fml::FilePermission::kRead
);
28
ASSERT_TRUE(dir.is_valid());
29
}
30
31
}
// namespace testing
32
}
// namespace fml
TEST
#define TEST(S, s, D, expected)
Definition
FitsInTest.cpp:15
fml::ScopedTemporaryDirectory
Definition
file.h:140
fml::ScopedTemporaryDirectory::path
const std::string & path() const
Definition
file.h:146
fml::UniqueObject< int, internal::os_unix::UniqueFDTraits >
fml
Definition
ascii_trie.cc:9
fml::Utf8ToWideString
std::wstring Utf8ToWideString(const std::string_view str)
Definition
wstring_conversion.cc:21
fml::OpenDirectory
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition
file_posix.cc:97
fml::FilePermission::kRead
@ kRead
CreateFile
#define CreateFile
Definition
windows_types.h:251
Generated on Fri Apr 26 2024 06:14:06 for Flutter Engine by
1.9.8