Browse Source

Merge pull request #1104 from reillyeon:chromium_env

PiperOrigin-RevId: 520172744
pull/1/head
Victor Costan 1 year ago
parent
commit
9cbbc5fb75
3 changed files with 21 additions and 0 deletions
  1. +6
    -0
      db/db_test.cc
  2. +5
    -0
      db/recovery_test.cc
  3. +10
    -0
      util/env_test.cc

+ 6
- 0
db/db_test.cc View File

@ -1722,8 +1722,14 @@ TEST_F(DBTest, DestroyEmptyDir) {
ASSERT_TRUE(env.FileExists(dbname)); ASSERT_TRUE(env.FileExists(dbname));
std::vector<std::string> children; std::vector<std::string> children;
ASSERT_LEVELDB_OK(env.GetChildren(dbname, &children)); ASSERT_LEVELDB_OK(env.GetChildren(dbname, &children));
#if defined(LEVELDB_PLATFORM_CHROMIUM)
// TODO(https://crbug.com/1428746): Chromium's file system abstraction always
// filters out '.' and '..'.
ASSERT_EQ(0, children.size());
#else
// The stock Env's do not filter out '.' and '..' special files. // The stock Env's do not filter out '.' and '..' special files.
ASSERT_EQ(2, children.size()); ASSERT_EQ(2, children.size());
#endif // defined(LEVELDB_PLATFORM_CHROMIUM)
ASSERT_LEVELDB_OK(DestroyDB(dbname, opts)); ASSERT_LEVELDB_OK(DestroyDB(dbname, opts));
ASSERT_TRUE(!env.FileExists(dbname)); ASSERT_TRUE(!env.FileExists(dbname));

+ 5
- 0
db/recovery_test.cc View File

@ -328,7 +328,12 @@ TEST_F(RecoveryTest, ManifestMissing) {
RemoveManifestFile(); RemoveManifestFile();
Status status = OpenWithStatus(); Status status = OpenWithStatus();
#if defined(LEVELDB_PLATFORM_CHROMIUM)
// TODO(crbug.com/760362): See comment in MakeIOError() from env_chromium.cc.
ASSERT_TRUE(status.IsIOError());
#else
ASSERT_TRUE(status.IsCorruption()); ASSERT_TRUE(status.IsCorruption());
#endif // defined(LEVELDB_PLATFORM_CHROMIUM)
} }
} // namespace leveldb } // namespace leveldb

+ 10
- 0
util/env_test.cc View File

@ -180,11 +180,21 @@ TEST_F(EnvTest, TestOpenNonExistentFile) {
RandomAccessFile* random_access_file; RandomAccessFile* random_access_file;
Status status = Status status =
env_->NewRandomAccessFile(non_existent_file, &random_access_file); env_->NewRandomAccessFile(non_existent_file, &random_access_file);
#if defined(LEVELDB_PLATFORM_CHROMIUM)
// TODO(crbug.com/760362): See comment in MakeIOError() from env_chromium.cc.
ASSERT_TRUE(status.IsIOError());
#else
ASSERT_TRUE(status.IsNotFound()); ASSERT_TRUE(status.IsNotFound());
#endif // defined(LEVELDB_PLATFORM_CHROMIUM)
SequentialFile* sequential_file; SequentialFile* sequential_file;
status = env_->NewSequentialFile(non_existent_file, &sequential_file); status = env_->NewSequentialFile(non_existent_file, &sequential_file);
#if defined(LEVELDB_PLATFORM_CHROMIUM)
// TODO(crbug.com/760362): See comment in MakeIOError() from env_chromium.cc.
ASSERT_TRUE(status.IsIOError());
#else
ASSERT_TRUE(status.IsNotFound()); ASSERT_TRUE(status.IsNotFound());
#endif // defined(LEVELDB_PLATFORM_CHROMIUM)
} }
TEST_F(EnvTest, ReopenWritableFile) { TEST_F(EnvTest, ReopenWritableFile) {

Loading…
Cancel
Save