chromium/components/storage_monitor/storage_monitor_linux_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

// StorageMonitorLinux unit tests.

#include "components/storage_monitor/storage_monitor_linux.h"

#include <mntent.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

#include <memory>
#include <string>

#include "base/check.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/task_environment.h"
#include "components/storage_monitor/mock_removable_storage_observer.h"
#include "components/storage_monitor/removable_device_constants.h"
#include "components/storage_monitor/storage_info.h"
#include "components/storage_monitor/storage_monitor.h"
#include "components/storage_monitor/test_storage_monitor.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace storage_monitor {

namespace {

const char kValidFS[] =;
const char kInvalidFS[] =;

const char kInvalidPath[] =;

const char kDeviceDCIM1[] =;
const char kDeviceDCIM2[] =;
const char kDeviceDCIM3[] =;
const char kDeviceNoDCIM[] =;
const char kDeviceFixed[] =;

const char kInvalidDevice[] =;

const char kMountPointA[] =;
const char kMountPointB[] =;
const char kMountPointC[] =;

struct TestDeviceData {};

const TestDeviceData kTestDeviceData[] =;

std::unique_ptr<StorageInfo> GetDeviceInfo(const base::FilePath& device_path,
                                           const base::FilePath& mount_point) {}

uint64_t GetDevicePartitionSize(const std::string& device) {}

std::string GetDeviceId(const std::string& device) {}

class TestStorageMonitorLinux : public StorageMonitorLinux {};

class StorageMonitorLinuxTest : public testing::Test {};

// TODO(crbug.com/40822314): This test is flaky.
// Simple test case where we attach and detach a media device.
TEST_F(StorageMonitorLinuxTest, DISABLED_BasicAttachDetach) {}

// Only removable devices are recognized.
// This test is flaky, see https://crbug.com/1012211
TEST_F(StorageMonitorLinuxTest, Removable) {}

// More complicated test case with multiple devices on multiple mount points.
TEST_F(StorageMonitorLinuxTest, SwapMountPoints) {}

// More complicated test case with multiple devices on multiple mount points.
TEST_F(StorageMonitorLinuxTest, MultiDevicesMultiMountPoints) {}

TEST_F(StorageMonitorLinuxTest, MultipleMountPointsWithNonDCIMDevices) {}

TEST_F(StorageMonitorLinuxTest, DeviceLookUp) {}

TEST_F(StorageMonitorLinuxTest, DevicePartitionSize) {}

}  // namespace

}  // namespace storage_monitor