Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2153)

Unified Diff: chrome/browser/chromeos/session_length_limiter_unittest.cc

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/session_length_limiter_unittest.cc
diff --git a/chrome/browser/chromeos/session_length_limiter_unittest.cc b/chrome/browser/chromeos/session_length_limiter_unittest.cc
index 43a7640cc38e84b7dde1ffd7d10105483b3a78f3..e9645316e26c6d21f94573418d2e6fe1036892c5 100644
--- a/chrome/browser/chromeos/session_length_limiter_unittest.cc
+++ b/chrome/browser/chromeos/session_length_limiter_unittest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "base/compiler_specific.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/test_mock_time_task_runner.h"
@@ -103,7 +104,7 @@ void SessionLengthLimiterTest::TearDown() {
void SessionLengthLimiterTest::SetSessionUserActivitySeenPref(
bool user_activity_seen) {
local_state_.SetUserPref(prefs::kSessionUserActivitySeen,
- new base::Value(user_activity_seen));
+ base::MakeUnique<base::Value>(user_activity_seen));
}
void SessionLengthLimiterTest::ClearSessionUserActivitySeenPref() {
@@ -122,7 +123,7 @@ bool SessionLengthLimiterTest::GetSessionUserActivitySeenPref() {
void SessionLengthLimiterTest::SetSessionStartTimePref(
const base::TimeTicks& session_start_time) {
local_state_.SetUserPref(prefs::kSessionStartTime,
- new base::Value(base::Int64ToString(
+ base::MakeUnique<base::Value>(base::Int64ToString(
session_start_time.ToInternalValue())));
}
@@ -142,9 +143,9 @@ base::TimeTicks SessionLengthLimiterTest::GetSessionStartTimePref() {
void SessionLengthLimiterTest::SetSessionLengthLimitPref(
const base::TimeDelta& session_length_limit) {
- local_state_.SetUserPref(
- prefs::kSessionLengthLimit,
- new base::Value(static_cast<int>(session_length_limit.InMilliseconds())));
+ local_state_.SetUserPref(prefs::kSessionLengthLimit,
+ base::MakeUnique<base::Value>(static_cast<int>(
+ session_length_limit.InMilliseconds())));
UpdateSessionStartTimeIfWaitingForUserActivity();
}
@@ -156,8 +157,9 @@ void SessionLengthLimiterTest::ClearSessionLengthLimitPref() {
void SessionLengthLimiterTest::SetWaitForInitialUserActivityPref(
bool wait_for_initial_user_activity) {
UpdateSessionStartTimeIfWaitingForUserActivity();
- local_state_.SetUserPref(prefs::kSessionWaitForInitialUserActivity,
- new base::Value(wait_for_initial_user_activity));
+ local_state_.SetUserPref(
+ prefs::kSessionWaitForInitialUserActivity,
+ base::MakeUnique<base::Value>(wait_for_initial_user_activity));
}
void SessionLengthLimiterTest::SimulateUserActivity() {

Powered by Google App Engine
This is Rietveld 408576698