Commit ec966cb5 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[s13n] Add IdentityTestEnvironment{Profile,BrowserState}Adaptor::CreateXXX...

[s13n] Add IdentityTestEnvironment{Profile,BrowserState}Adaptor::CreateXXX variant that takes a Builder

In follow ups, users of the existing APIs can be converted.

BUG=904419

Change-Id: I6691fb32ec79d5de5c97c09bb886bf3d6bc2c047
Reviewed-on: https://chromium-review.googlesource.com/c/1332749Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#607572}
parent 4c6f6e21
......@@ -44,13 +44,20 @@ IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment(
builder.AddTestingFactory(input_factory.first, input_factory.second);
}
if (prefs)
builder.SetPrefService(std::move(prefs));
return CreateProfileForIdentityTestEnvironment(builder);
}
// static
std::unique_ptr<TestingProfile>
IdentityTestEnvironmentProfileAdaptor::CreateProfileForIdentityTestEnvironment(
TestingProfile::Builder& builder) {
for (auto& identity_factory : GetIdentityTestEnvironmentFactories()) {
builder.AddTestingFactory(identity_factory.first, identity_factory.second);
}
if (prefs)
builder.SetPrefService(std::move(prefs));
return builder.Build();
}
......
......@@ -31,6 +31,11 @@ class IdentityTestEnvironmentProfileAdaptor {
const TestingProfile::TestingFactories& input_factories,
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs = nullptr);
// Creates and returns a TestingProfile that has been configured with the
// given |builder|.
static std::unique_ptr<TestingProfile>
CreateProfileForIdentityTestEnvironment(TestingProfile::Builder& builder);
// Appends the set of testing factories that identity::IdentityTestEnvironment
// requires to |factories_to_append_to|, which should be the set of testing
// factories supplied to TestingProfile (via one of the various mechanisms for
......
......@@ -45,6 +45,14 @@ IdentityTestEnvironmentChromeBrowserStateAdaptor::
builder.AddTestingFactory(input_factory.first, input_factory.second);
}
return CreateChromeBrowserStateForIdentityTestEnvironment(builder);
}
// static
std::unique_ptr<TestChromeBrowserState>
IdentityTestEnvironmentChromeBrowserStateAdaptor::
CreateChromeBrowserStateForIdentityTestEnvironment(
TestChromeBrowserState::Builder& builder) {
for (auto& identity_factory : GetIdentityTestEnvironmentFactories()) {
builder.AddTestingFactory(identity_factory.first, identity_factory.second);
}
......
......@@ -29,6 +29,12 @@ class IdentityTestEnvironmentChromeBrowserStateAdaptor {
CreateChromeBrowserStateForIdentityTestEnvironment(
const TestChromeBrowserState::TestingFactories& input_factories);
// Creates and returns a TestChromeBrowserState that has been configured with
// the given |builder|.
static std::unique_ptr<TestChromeBrowserState>
CreateChromeBrowserStateForIdentityTestEnvironment(
TestChromeBrowserState::Builder& builder);
// Appends the set of testing factories that identity::IdentityTestEnvironment
// requires to |factories_to_append_to|, which should be the set of testing
// factories supplied to TestChromeBrowserState (via one of the various
......
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