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

Merge DiceTestSigninClient functionality into TestSigninClient

This is a preparation CL that merges DiceTestSigninClient functionality
(see account_reconcilor_unittest.cc) into TestSigninClient.

Next, IdentityTestEnvironment ctor will be updated to take
a SigninClient instance, given that AccountReconcilor still
needs a custom SigninClient instance.

BUG=926890

Change-Id: Ib45d650b24ac1fe4681b9ef5c9f224c74a3bd847
Reviewed-on: https://chromium-review.googlesource.com/c/1477818Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#633757}
parent 8bdd43ff
...@@ -60,22 +60,6 @@ using FakeSigninManagerForTesting = FakeSigninManagerBase; ...@@ -60,22 +60,6 @@ using FakeSigninManagerForTesting = FakeSigninManagerBase;
using FakeSigninManagerForTesting = FakeSigninManager; using FakeSigninManagerForTesting = FakeSigninManager;
#endif #endif
// TestSigninClient keeping track of the dice migration.
class DiceTestSigninClient : public TestSigninClient {
public:
explicit DiceTestSigninClient(PrefService* prefs) : TestSigninClient(prefs) {}
void SetReadyForDiceMigration(bool ready) override {
is_ready_for_dice_migration_ = ready;
}
bool is_ready_for_dice_migration() { return is_ready_for_dice_migration_; }
private:
bool is_ready_for_dice_migration_ = false;
DISALLOW_COPY_AND_ASSIGN(DiceTestSigninClient);
};
// An AccountReconcilorDelegate that records all calls (Spy pattern). // An AccountReconcilorDelegate that records all calls (Spy pattern).
class SpyReconcilorDelegate : public signin::AccountReconcilorDelegate { class SpyReconcilorDelegate : public signin::AccountReconcilorDelegate {
public: public:
...@@ -251,7 +235,7 @@ class AccountReconcilorTest : public ::testing::Test { ...@@ -251,7 +235,7 @@ class AccountReconcilorTest : public ::testing::Test {
identity::IdentityTestEnvironment* identity_test_env() { identity::IdentityTestEnvironment* identity_test_env() {
return &identity_test_env_; return &identity_test_env_;
} }
DiceTestSigninClient* test_signin_client() { return &test_signin_client_; } TestSigninClient* test_signin_client() { return &test_signin_client_; }
AccountTrackerService* account_tracker() { return &account_tracker_; } AccountTrackerService* account_tracker() { return &account_tracker_; }
base::HistogramTester* histogram_tester() { return &histogram_tester_; } base::HistogramTester* histogram_tester() { return &histogram_tester_; }
...@@ -290,7 +274,7 @@ class AccountReconcilorTest : public ::testing::Test { ...@@ -290,7 +274,7 @@ class AccountReconcilorTest : public ::testing::Test {
base::test::ScopedTaskEnvironment task_environment_; base::test::ScopedTaskEnvironment task_environment_;
signin::AccountConsistencyMethod account_consistency_; signin::AccountConsistencyMethod account_consistency_;
sync_preferences::TestingPrefServiceSyncable pref_service_; sync_preferences::TestingPrefServiceSyncable pref_service_;
DiceTestSigninClient test_signin_client_; TestSigninClient test_signin_client_;
FakeProfileOAuth2TokenService token_service_; FakeProfileOAuth2TokenService token_service_;
AccountTrackerService account_tracker_; AccountTrackerService account_tracker_;
FakeAccountFetcherService account_fetcher_; FakeAccountFetcherService account_fetcher_;
......
...@@ -16,7 +16,8 @@ TestSigninClient::TestSigninClient(PrefService* pref_service) ...@@ -16,7 +16,8 @@ TestSigninClient::TestSigninClient(PrefService* pref_service)
: pref_service_(pref_service), : pref_service_(pref_service),
are_signin_cookies_allowed_(true), are_signin_cookies_allowed_(true),
network_calls_delayed_(false), network_calls_delayed_(false),
is_signout_allowed_(true) {} is_signout_allowed_(true),
is_ready_for_dice_migration_(false) {}
TestSigninClient::~TestSigninClient() {} TestSigninClient::~TestSigninClient() {}
...@@ -98,3 +99,7 @@ void TestSigninClient::PreGaiaLogout(base::OnceClosure callback) { ...@@ -98,3 +99,7 @@ void TestSigninClient::PreGaiaLogout(base::OnceClosure callback) {
std::move(callback).Run(); std::move(callback).Run();
} }
} }
void TestSigninClient::SetReadyForDiceMigration(bool ready) {
is_ready_for_dice_migration_ = ready;
}
...@@ -67,6 +67,8 @@ class TestSigninClient : public SigninClient { ...@@ -67,6 +67,8 @@ class TestSigninClient : public SigninClient {
void set_is_signout_allowed(bool value) { is_signout_allowed_ = value; } void set_is_signout_allowed(bool value) { is_signout_allowed_ = value; }
bool is_ready_for_dice_migration() { return is_ready_for_dice_migration_; }
// When |value| is true, network calls posted through DelayNetworkCall() are // When |value| is true, network calls posted through DelayNetworkCall() are
// delayed indefinitely. // delayed indefinitely.
// When |value| is false, all pending calls are unblocked, and new calls are // When |value| is false, all pending calls are unblocked, and new calls are
...@@ -88,6 +90,7 @@ class TestSigninClient : public SigninClient { ...@@ -88,6 +90,7 @@ class TestSigninClient : public SigninClient {
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
override; override;
void PreGaiaLogout(base::OnceClosure callback) override; void PreGaiaLogout(base::OnceClosure callback) override;
void SetReadyForDiceMigration(bool ready) override;
private: private:
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
...@@ -97,6 +100,8 @@ class TestSigninClient : public SigninClient { ...@@ -97,6 +100,8 @@ class TestSigninClient : public SigninClient {
bool are_signin_cookies_allowed_; bool are_signin_cookies_allowed_;
bool network_calls_delayed_; bool network_calls_delayed_;
bool is_signout_allowed_; bool is_signout_allowed_;
bool is_ready_for_dice_migration_;
std::vector<base::OnceClosure> delayed_network_calls_; std::vector<base::OnceClosure> delayed_network_calls_;
DISALLOW_COPY_AND_ASSIGN(TestSigninClient); DISALLOW_COPY_AND_ASSIGN(TestSigninClient);
......
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