Commit d3adcc7e authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Register factories for ExternalProviderImplChromeOSTest

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 ExternalProviderImplChromeOSTest to use the proper factory
by registering them in the super class.

Bug: 982751
Change-Id: Id116ee5b0df4b69ccf31a152c3c0318aaf94ef45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809158
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697571}
parent 370dc44f
......@@ -24,6 +24,8 @@
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_browser_process.h"
......@@ -69,6 +71,10 @@ std::unique_ptr<TestingProfile> BuildTestingProfile(
if (params.profile_is_supervised)
profile_builder.SetSupervisedUserId("asdf");
profile_builder.AddTestingFactories(
IdentityTestEnvironmentProfileAdaptor::
GetIdentityTestEnvironmentFactories());
profile_builder.SetPath(params.profile_path);
return profile_builder.Build();
}
......
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