Commit 3808cb59 authored by Bruno Santos's avatar Bruno Santos Committed by Commit Bot

Record calls to GetUserInfo method.

Bug: 963993
Change-Id: I2bdeb796e971f5055234a1160315c1a554ad72df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622666Reviewed-by: default avatarLucas Tenório <ltenorio@chromium.org>
Commit-Queue: Bruno Santos <brunoad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662263}
parent 3ecf5696
......@@ -8,6 +8,7 @@
#include <utility>
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/kiosk_next_home/metrics_helper.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
......@@ -22,6 +23,7 @@ IdentityControllerImpl::~IdentityControllerImpl() = default;
void IdentityControllerImpl::GetUserInfo(
mojom::IdentityController::GetUserInfoCallback callback) {
RecordBridgeAction(BridgeAction::kGetUserInfo);
auto user_info = mojom::UserInfo::New();
user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser();
user_info->given_name = base::UTF16ToUTF8(user->GetGivenName());
......
......@@ -10,7 +10,9 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_task_environment.h"
#include "chrome/browser/chromeos/kiosk_next_home/metrics_helper.h"
#include "components/user_manager/fake_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user_manager.h"
......@@ -48,6 +50,8 @@ class IdentityControllerImplTest : public testing::Test {
return identity_controller_.get();
}
base::HistogramTester histogram_tester_;
private:
base::test::ScopedTaskEnvironment task_environemnt_;
std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_;
......@@ -66,6 +70,8 @@ TEST_F(IdentityControllerImplTest, GetUserInfo) {
run_loop.Run();
EXPECT_EQ(returned_user_info->display_name, kUserDisplayName);
EXPECT_EQ(returned_user_info->given_name, kUserGivenName);
histogram_tester_.ExpectUniqueSample("KioskNextHome.Bridge.Action",
BridgeAction::kGetUserInfo, 1);
}
} // namespace kiosk_next_home
......
......@@ -17,7 +17,8 @@ enum class BridgeAction {
kNotifiedAppChange = 3,
kGetAndroidId = 4,
kLaunchIntent = 5,
kMaxValue = kLaunchIntent,
kGetUserInfo = 6,
kMaxValue = kGetUserInfo,
};
// These values are persisted to logs. Entries should not be renumbered and
......
......@@ -31366,6 +31366,7 @@ Called by update_gpu_driver_bug_workaround_entries.py.-->
<int value="3" label="Notified of app change"/>
<int value="4" label="Get ARC Android id"/>
<int value="5" label="Launch intent"/>
<int value="6" label="Get user info"/>
</enum>
<enum name="KioskNextHomeLaunchIntentResult">
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