Commit 731a1cf7 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[s13n] Convert UserPolicySigninServiceTest way from SigninManager

This makes use of the helper IdentityTestEnvironmentProfileAdaptor.
In order to be able to construct the Profile object the same way as the
test originally was, and additional optional parameter was added to
IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment.

BUG=890783

Change-Id: I5c2a48dd4aa7e7377f8a7806717b513b7f27bfe0
Reviewed-on: https://chromium-review.googlesource.com/c/1301814Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#606434}
parent 85b48eb3
...@@ -36,7 +36,8 @@ std::unique_ptr<TestingProfile> IdentityTestEnvironmentProfileAdaptor:: ...@@ -36,7 +36,8 @@ std::unique_ptr<TestingProfile> IdentityTestEnvironmentProfileAdaptor::
// static // static
std::unique_ptr<TestingProfile> std::unique_ptr<TestingProfile>
IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment( IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment(
const TestingProfile::TestingFactories& input_factories) { const TestingProfile::TestingFactories& input_factories,
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
for (auto& input_factory : input_factories) { for (auto& input_factory : input_factories) {
...@@ -47,6 +48,9 @@ IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment( ...@@ -47,6 +48,9 @@ IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment(
builder.AddTestingFactory(identity_factory.first, identity_factory.second); builder.AddTestingFactory(identity_factory.first, identity_factory.second);
} }
if (prefs)
builder.SetPrefService(std::move(prefs));
return builder.Build(); return builder.Build();
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROME_BROWSER_SIGNIN_IDENTITY_TEST_ENVIRONMENT_PROFILE_ADAPTOR_H_ #define CHROME_BROWSER_SIGNIN_IDENTITY_TEST_ENVIRONMENT_PROFILE_ADAPTOR_H_
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "services/identity/public/cpp/identity_test_environment.h" #include "services/identity/public/cpp/identity_test_environment.h"
// Adaptor that supports identity::IdentityTestEnvironment's usage in testing // Adaptor that supports identity::IdentityTestEnvironment's usage in testing
...@@ -24,10 +25,11 @@ class IdentityTestEnvironmentProfileAdaptor { ...@@ -24,10 +25,11 @@ class IdentityTestEnvironmentProfileAdaptor {
CreateProfileForIdentityTestEnvironment(); CreateProfileForIdentityTestEnvironment();
// Like the above, but additionally configures the returned Profile with // Like the above, but additionally configures the returned Profile with
// |input_factories|. // |input_factories| and |prefs|.
static std::unique_ptr<TestingProfile> static std::unique_ptr<TestingProfile>
CreateProfileForIdentityTestEnvironment( CreateProfileForIdentityTestEnvironment(
const TestingProfile::TestingFactories& input_factories); const TestingProfile::TestingFactories& input_factories,
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs = nullptr);
// Appends the set of testing factories that identity::IdentityTestEnvironment // Appends the set of testing factories that identity::IdentityTestEnvironment
// requires to |factories_to_append_to|, which should be the set of testing // requires to |factories_to_append_to|, which should be the set of testing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment