Commit 3568bab9 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

Fix IdentityAPITest to handle DICE semantics

In identity_apitest.cc, there is a test that verifies that when the
primary account is cleared, the chrome.identity.onSignInChanged event
is fired. This event is fired when a refresh token is added/removed for
a given account. However, when DICE is enabled, clearing the primary
account does not result in its refresh token being removed (and hence
does not cause this event to fire).

This CL updates this test to short-circuit out if DICE is enabled. Note
that a different existing test already verifies that an event is fired
when the refresh token of the primary account is removed.

This CL is concretely necessary to unblock the elimination of
FakeSigninManager. When FakeSigninManager is eliminated, this test
(and others) will use a SigninManager instance that has been configured
with the account consistency mode passed by SigninManagerFactory,
rather than the account consistency mode being hardcoded to disabled.
Once the test is using SigninManager, we will update it to check that
the event is *not* fired if DICE is enabled. It's not yet possible to
do that as the test is still using FakeSigninManager.

Bug: 796544
Change-Id: I8ec51b1c960ea068cb984c1781e2cc84c72ce0e4
Reviewed-on: https://chromium-review.googlesource.com/c/1488876Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635486}
parent 9ce61ebf
......@@ -31,6 +31,7 @@
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_consistency_mode_manager.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/chrome_signin_client_test_util.h"
......@@ -2420,8 +2421,14 @@ IN_PROC_BROWSER_TEST_F(OnSignInChangedEventTest, FireOnPrimaryAccountSignIn) {
}
#if !defined(OS_CHROMEOS)
// Test that an event is fired when the primary account signs out.
// Test that an event is fired when the primary account signs out. Only
// applicable in non-DICE mode, as when DICE is enabled clearing the primary
// account does not result in its refresh token being removed and hence does
// not trigger an event to fire.
IN_PROC_BROWSER_TEST_F(OnSignInChangedEventTest, FireOnPrimaryAccountSignOut) {
if (AccountConsistencyModeManager::IsDiceEnabledForProfile(profile()))
return;
api::identity::AccountInfo account_info;
account_info.id = "gaia_id_for_primary_example.com";
AddExpectedEvent(api::identity::OnSignInChanged::Create(account_info, true));
......
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