chromium/chrome/browser/sync/test/integration/single_client_secondary_account_sync_test.cc

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

#include "base/callback_list.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/test/integration/secondary_account_helper.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/common/chrome_paths.h"
#include "components/sync/base/data_type.h"
#include "components/sync/service/glue/sync_transport_data_prefs.h"
#include "components/sync/service/sync_service_impl.h"
#include "content/public/test/browser_test.h"

namespace {

#if !BUILDFLAG(IS_CHROMEOS_ASH)
base::FilePath GetTestFilePathForCacheGuid() {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

class SingleClientSecondaryAccountSyncTest : public SyncTest {};

// The unconsented primary account isn't supported on ChromeOS.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientSecondaryAccountSyncTest,
                       StartsSyncTransportOnSignin) {}
#else
IN_PROC_BROWSER_TEST_F(SingleClientSecondaryAccountSyncTest,
                       DoesNotStartSyncTransportOnSignin) {
  ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";

  // Signing in (without explicitly setting up Sync) should do nothing here,
  // since we're on a platform where the unconsented primary account is not
  // supported.
  secondary_account_helper::SignInUnconsentedAccount(
      profile(), &test_url_loader_factory_, "[email protected]");
  EXPECT_EQ(syncer::SyncService::TransportState::DISABLED,
            GetSyncService(0)->GetTransportState());
}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

// ChromeOS doesn't support changes to the primary account after startup, so
// this test doesn't apply.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientSecondaryAccountSyncTest,
                       SwitchesFromTransportToFeature) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

// Regression test for crbug.com/955989 that verifies the cache GUID is not
// reset upon restart of the browser, in standalone transport mode with
// unconsented accounts.
//
// The unconsented primary account isn't supported on ChromeOS.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientSecondaryAccountSyncTest,
                       PRE_ReusesSameCacheGuid) {}

IN_PROC_BROWSER_TEST_F(SingleClientSecondaryAccountSyncTest,
                       ReusesSameCacheGuid) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace