chromium/chrome/browser/sync/test/integration/secondary_account_helper.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 "chrome/browser/sync/test/integration/secondary_account_helper.h"

#include <string>
#include <vector>

#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/chrome_signin_client_test_util.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "google_apis/gaia/gaia_auth_util.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/net/network_portal_detector_test_impl.h"
#include "chromeos/ash/components/network/network_handler.h"
#include "chromeos/ash/components/network/network_state.h"
#include "chromeos/ash/components/network/network_state_handler.h"
#include "chromeos/ash/components/network/portal_detector/network_portal_detector.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace secondary_account_helper {

namespace {

void OnWillCreateBrowserContextServices(
    network::TestURLLoaderFactory* test_url_loader_factory,
    content::BrowserContext* context) {}

void SetCookieForGaiaId(
    const std::string& gaia_id,
    const std::string& email,
    bool signed_out,
    signin::IdentityManager* identity_manager,
    network::TestURLLoaderFactory* test_url_loader_factory) {}

}  // namespace

base::CallbackListSubscription SetUpSigninClient(
    network::TestURLLoaderFactory* test_url_loader_factory) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
void InitNetwork() {
  auto* portal_detector = new ash::NetworkPortalDetectorTestImpl();

  const ash::NetworkState* default_network =
      ash::NetworkHandler::Get()->network_state_handler()->DefaultNetwork();

  portal_detector->SetDefaultNetworkForTesting(default_network->guid());

  // Takes ownership.
  ash::network_portal_detector::InitializeForTesting(portal_detector);
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

AccountInfo SignInUnconsentedAccount(
    Profile* profile,
    network::TestURLLoaderFactory* test_url_loader_factory,
    const std::string& email) {}

AccountInfo ImplicitSignInUnconsentedAccount(
    Profile* profile,
    network::TestURLLoaderFactory* test_url_loader_factory,
    const std::string& email) {}

void SignOut(Profile* profile,
             network::TestURLLoaderFactory* test_url_loader_factory) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
void GrantSyncConsent(Profile* profile, const std::string& email) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace secondary_account_helper