#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/containers/stack.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "chrome/browser/sync_file_system/drive_backend/callback_helper.h"
#include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h"
#include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.h"
#include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
#include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_engine.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_worker.h"
#include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
#include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
#include "chrome/browser/sync_file_system/local/local_file_sync_service.h"
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "chrome/test/base/testing_profile.h"
#include "components/drive/drive_uploader.h"
#include "components/drive/service/fake_drive_service.h"
#include "components/drive/service/test_util.h"
#include "components/services/filesystem/public/mojom/types.mojom.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "extensions/common/extension.h"
#include "google_apis/drive/drive_api_parser.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "storage/browser/file_system/file_system_context.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/leveldatabase/leveldb_chrome.h"
#define FPL(a) …
namespace sync_file_system {
namespace drive_backend {
FileEntryList;
namespace {
template <typename T>
void SetValueAndCallClosure(base::OnceClosure closure, T* arg_out, T arg) { … }
void SetSyncStatusAndUrl(base::OnceClosure closure,
SyncStatusCode* status_out,
storage::FileSystemURL* url_out,
SyncStatusCode status,
const storage::FileSystemURL& url) { … }
}
class DriveBackendSyncTest : public testing::Test,
public LocalFileSyncService::Observer,
public RemoteFileSyncService::Observer { … };
TEST_F(DriveBackendSyncTest, LocalToRemoteBasicTest) { … }
TEST_F(DriveBackendSyncTest, RemoteToLocalBasicTest) { … }
TEST_F(DriveBackendSyncTest, LocalFileUpdateTest) { … }
TEST_F(DriveBackendSyncTest, RemoteFileUpdateTest) { … }
TEST_F(DriveBackendSyncTest, LocalFileDeletionTest) { … }
TEST_F(DriveBackendSyncTest, RemoteFileDeletionTest) { … }
TEST_F(DriveBackendSyncTest, RemoteRenameTest) { … }
TEST_F(DriveBackendSyncTest, RemoteRenameAndRevertTest) { … }
TEST_F(DriveBackendSyncTest, ReorganizeToOtherFolder) { … }
TEST_F(DriveBackendSyncTest, ReorganizeToOtherApp) { … }
TEST_F(DriveBackendSyncTest, ReorganizeToUnmanagedArea) { … }
TEST_F(DriveBackendSyncTest, ReorganizeToMultipleParents) { … }
TEST_F(DriveBackendSyncTest, ReorganizeAndRevert) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_ConflictTest_AddFolder_AddFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_DeleteFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_AddFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFolder_DeleteFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFolder_AddFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFolder_DeleteFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFolder_AddFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFolder_DeleteFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_AddFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_DeleteFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_AddFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_AddFile_DeleteFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_UpdateFile_DeleteFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFile_AddFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFile_DeleteFolder) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFile_AddFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFile_UpdateFile) { … }
TEST_F(DriveBackendSyncTest, ConflictTest_DeleteFile_DeleteFile) { … }
}
}