Commit ffafd5af authored by David Roger's avatar David Roger Committed by Commit Bot

[signin] Add histogram recording wether Dice is enabled at startup.

Bug: 771908
Change-Id: Iac535502e4584c3756712cb49b4afb4608fab925
Reviewed-on: https://chromium-review.googlesource.com/737639Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512501}
parent 9db53d7e
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
...@@ -94,14 +95,16 @@ AccountReconcilor::AccountReconcilor( ...@@ -94,14 +95,16 @@ AccountReconcilor::AccountReconcilor(
account_reconcilor_lock_count_(0), account_reconcilor_lock_count_(0),
reconcile_on_unblock_(false) { reconcile_on_unblock_(false) {
VLOG(1) << "AccountReconcilor::AccountReconcilor"; VLOG(1) << "AccountReconcilor::AccountReconcilor";
PrefService* prefs = client_->GetPrefs();
if (ShouldMigrateToDiceOnStartup()) { if (ShouldMigrateToDiceOnStartup()) {
PrefService* prefs = client_->GetPrefs();
DCHECK(prefs); DCHECK(prefs);
if (!signin::IsDiceEnabledForProfile(prefs)) if (!signin::IsDiceEnabledForProfile(prefs))
VLOG(1) << "Profile is migrating to Dice"; VLOG(1) << "Profile is migrating to Dice";
signin::MigrateProfileToDice(client->GetPrefs()); signin::MigrateProfileToDice(client->GetPrefs());
DCHECK(signin::IsDiceEnabledForProfile(prefs)); DCHECK(signin::IsDiceEnabledForProfile(prefs));
} }
UMA_HISTOGRAM_BOOLEAN("Signin.DiceEnabledForProfile",
signin::IsDiceEnabledForProfile(prefs));
} }
AccountReconcilor::~AccountReconcilor() { AccountReconcilor::~AccountReconcilor() {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include "base/memory/ptr_util.h"
#include "components/signin/core/browser/account_reconcilor.h" #include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/fake_signin_manager.h" #include "components/signin/core/browser/fake_signin_manager.h"
...@@ -76,8 +77,8 @@ class FakeAccountConsistencyService : public AccountConsistencyService { ...@@ -76,8 +77,8 @@ class FakeAccountConsistencyService : public AccountConsistencyService {
// Mock AccountReconcilor to catch call to OnReceivedManageAccountsResponse. // Mock AccountReconcilor to catch call to OnReceivedManageAccountsResponse.
class MockAccountReconcilor : public AccountReconcilor { class MockAccountReconcilor : public AccountReconcilor {
public: public:
MockAccountReconcilor() MockAccountReconcilor(SigninClient* client)
: AccountReconcilor(nullptr, nullptr, nullptr, nullptr) {} : AccountReconcilor(nullptr, nullptr, client, nullptr) {}
MOCK_METHOD1(OnReceivedManageAccountsResponse, void(signin::GAIAServiceType)); MOCK_METHOD1(OnReceivedManageAccountsResponse, void(signin::GAIAServiceType));
}; };
...@@ -148,6 +149,8 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -148,6 +149,8 @@ class AccountConsistencyServiceTest : public PlatformTest {
false /* store_last_modified */); false /* store_last_modified */);
cookie_settings_ = cookie_settings_ =
new content_settings::CookieSettings(settings_map_.get(), &prefs_, ""); new content_settings::CookieSettings(settings_map_.get(), &prefs_, "");
account_reconcilor_ =
base::MakeUnique<MockAccountReconcilor>(signin_client_.get());
ResetAccountConsistencyService(); ResetAccountConsistencyService();
} }
...@@ -184,7 +187,7 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -184,7 +187,7 @@ class AccountConsistencyServiceTest : public PlatformTest {
account_consistency_service_->Shutdown(); account_consistency_service_->Shutdown();
} }
account_consistency_service_.reset(new FakeAccountConsistencyService( account_consistency_service_.reset(new FakeAccountConsistencyService(
&browser_state_, &account_reconcilor_, cookie_settings_, &browser_state_, account_reconcilor_.get(), cookie_settings_,
gaia_cookie_manager_service_.get(), signin_client_.get(), gaia_cookie_manager_service_.get(), signin_client_.get(),
signin_manager_.get())); signin_manager_.get()));
} }
...@@ -237,7 +240,6 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -237,7 +240,6 @@ class AccountConsistencyServiceTest : public PlatformTest {
// Creates test threads, necessary for ActiveStateManager that needs a UI // Creates test threads, necessary for ActiveStateManager that needs a UI
// thread. // thread.
web::TestWebThreadBundle thread_bundle_; web::TestWebThreadBundle thread_bundle_;
MockAccountReconcilor account_reconcilor_;
AccountTrackerService account_tracker_service_; AccountTrackerService account_tracker_service_;
web::TestBrowserState browser_state_; web::TestBrowserState browser_state_;
sync_preferences::TestingPrefServiceSyncable prefs_; sync_preferences::TestingPrefServiceSyncable prefs_;
...@@ -248,6 +250,7 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -248,6 +250,7 @@ class AccountConsistencyServiceTest : public PlatformTest {
std::unique_ptr<TestSigninClient> signin_client_; std::unique_ptr<TestSigninClient> signin_client_;
std::unique_ptr<FakeSigninManager> signin_manager_; std::unique_ptr<FakeSigninManager> signin_manager_;
std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_;
std::unique_ptr<MockAccountReconcilor> account_reconcilor_;
scoped_refptr<HostContentSettingsMap> settings_map_; scoped_refptr<HostContentSettingsMap> settings_map_;
scoped_refptr<content_settings::CookieSettings> cookie_settings_; scoped_refptr<content_settings::CookieSettings> cookie_settings_;
bool remove_cookie_callback_called_; bool remove_cookie_callback_called_;
...@@ -388,8 +391,8 @@ TEST_F(AccountConsistencyServiceTest, ChromeManageAccountsDefault) { ...@@ -388,8 +391,8 @@ TEST_F(AccountConsistencyServiceTest, ChromeManageAccountsDefault) {
HTTPVersion:@"HTTP/1.1" HTTPVersion:@"HTTP/1.1"
headerFields:headers]; headerFields:headers];
account_consistency_service_->SetWebStateHandler(&web_state_, delegate); account_consistency_service_->SetWebStateHandler(&web_state_, delegate);
EXPECT_CALL(account_reconcilor_, OnReceivedManageAccountsResponse( EXPECT_CALL(*account_reconcilor_, OnReceivedManageAccountsResponse(
signin::GAIA_SERVICE_TYPE_DEFAULT)) signin::GAIA_SERVICE_TYPE_DEFAULT))
.Times(1); .Times(1);
EXPECT_FALSE( EXPECT_FALSE(
web_state_.ShouldAllowResponse(response, /* for_main_frame = */ true)); web_state_.ShouldAllowResponse(response, /* for_main_frame = */ true));
......
...@@ -77976,6 +77976,13 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -77976,6 +77976,13 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<summary>The total number of accounts in the cookie jar.</summary> <summary>The total number of accounts in the cookie jar.</summary>
</histogram> </histogram>
<histogram name="Signin.DiceEnabledForProfile" enum="Boolean">
<owner>droger@chromium.org</owner>
<summary>
Whether Dice is enabled for the current profile, recorded at startup.
</summary>
</histogram>
<histogram name="Signin.DiceResponseHeader" enum="SigninDiceResponseHeader"> <histogram name="Signin.DiceResponseHeader" enum="SigninDiceResponseHeader">
<owner>droger@chromium.org</owner> <owner>droger@chromium.org</owner>
<summary>Records Dice responses (signin and signout).</summary> <summary>Records Dice responses (signin and signout).</summary>
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