Commit 46556ed4 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Register factories for ChromeAssistantUtilTest

When using IdentityTestEnvironmentProfileAdaptor, it is required
to register the testing factories when creating the Profile, as
the adaptor will expect the IdentityManager to have been created
with certain fakes.

If the factories are not set, then it is possible to encounter
Undefined Behaviour (as IdentityTestEnvironment cast some of the
objects to the expected fake subclasses) in the worst case or
just non-fonctioning test (calling undefined methods) on certain
platforms.

Fix ChromeAssistantUtilTest to use the proper factory.

Bug: 982751
Change-Id: Ic61a874b300cf36f3575f524a8bf7e57e0dc96b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1806741Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697542}
parent 5fba6ea7
......@@ -149,7 +149,11 @@ class ChromeAssistantUtilTest : public testing::Test {
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(profile_manager_->SetUp());
profile_ = profile_manager_->CreateTestingProfile(kTestProfileName);
profile_ = profile_manager_->CreateTestingProfile(
kTestProfileName, /*prefs=*/{}, base::UTF8ToUTF16(kTestProfileName),
/*avatar_id=*/0, /*supervised_user_id=*/{},
IdentityTestEnvironmentProfileAdaptor::
GetIdentityTestEnvironmentFactories());
identity_test_env_adaptor_ =
std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile_);
user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>(
......
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