chromium/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc

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

#include "chrome/browser/sync_file_system/sync_file_system_service.h"

#include <stddef.h>

#include <memory>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.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/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/mock_sync_status_observer.h"
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h"
#include "chrome/browser/sync_file_system/sync_callbacks.h"
#include "chrome/browser/sync_file_system/sync_event_observer.h"
#include "chrome/browser/sync_file_system/sync_file_metadata.h"
#include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
#include "chrome/browser/sync_file_system/sync_status_code.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "chrome/test/base/testing_profile.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 "storage/browser/file_system/file_system_context.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/leveldatabase/leveldb_chrome.h"

_;
FileSystemURL;
FileSystemURLSet;
AnyNumber;
AtLeast;
InSequence;
InvokeWithoutArgs;
Return;
StrictMock;
WithArg;

namespace sync_file_system {

namespace {

const char kOrigin[] =;

template <typename R> struct AssignTrait {};

template <> struct AssignTrait<SyncFileStatus> {};

template <typename R>
void AssignValueAndQuit(base::RunLoop* run_loop,
                        SyncStatusCode* status_out, R* value_out,
                        SyncStatusCode status,
                        typename AssignTrait<R>::ArgumentType value) {}

// This is called on IO thread. Posts |callback| to be called on UI thread.
void VerifyFileError(base::OnceClosure callback, base::File::Error error) {}

}  // namespace

class MockSyncEventObserver : public SyncEventObserver {};

ACTION_P(RecordState, states) {}

struct PostSyncFileCallback {};

struct PostOnceClosureFunctor {};

class SyncFileSystemServiceTest : public testing::Test {};

TEST_F(SyncFileSystemServiceTest, InitializeForApp) {}

TEST_F(SyncFileSystemServiceTest, InitializeForAppSuccess) {}

TEST_F(SyncFileSystemServiceTest, InitializeForAppWithNetworkFailure) {}

// Disabled due to flakiness: crbug.com/1222929
TEST_F(SyncFileSystemServiceTest, DISABLED_InitializeForAppWithError) {}

// Disabled due to flakiness: crbug.com/1345010
TEST_F(SyncFileSystemServiceTest, DISABLED_SimpleLocalSyncFlow) {}

TEST_F(SyncFileSystemServiceTest, SimpleRemoteSyncFlow) {}

TEST_F(SyncFileSystemServiceTest, SimpleSyncFlowWithFileBusy) {}

#if defined(THREAD_SANITIZER)
// SyncFileSystemServiceTest.GetFileSyncStatus fails under ThreadSanitizer,
// see http://crbug.com/294904.
#define MAYBE_GetFileSyncStatus
#else
#define MAYBE_GetFileSyncStatus
#endif
TEST_F(SyncFileSystemServiceTest, MAYBE_GetFileSyncStatus) {}

}  // namespace sync_file_system