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

Side by Side Diff: chrome/browser/engagement/site_engagement_service_unittest.cc

Issue 2111103002: Make callers of FromUTC(Local)Exploded in chrome/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/engagement/site_engagement_service.h" 5 #include "chrome/browser/engagement/site_engagement_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 base::Time::Exploded exploded_reference_time; 78 base::Time::Exploded exploded_reference_time;
79 exploded_reference_time.year = 2015; 79 exploded_reference_time.year = 2015;
80 exploded_reference_time.month = 1; 80 exploded_reference_time.month = 1;
81 exploded_reference_time.day_of_month = 30; 81 exploded_reference_time.day_of_month = 30;
82 exploded_reference_time.day_of_week = 5; 82 exploded_reference_time.day_of_week = 5;
83 exploded_reference_time.hour = 11; 83 exploded_reference_time.hour = 11;
84 exploded_reference_time.minute = 0; 84 exploded_reference_time.minute = 0;
85 exploded_reference_time.second = 0; 85 exploded_reference_time.second = 0;
86 exploded_reference_time.millisecond = 0; 86 exploded_reference_time.millisecond = 0;
87 87
88 return base::Time::FromLocalExploded(exploded_reference_time); 88 base::Time out_time;
89 EXPECT_TRUE(
90 base::Time::FromLocalExploded(exploded_reference_time, &out_time));
91 return out_time;
89 } 92 }
90 93
91 std::unique_ptr<KeyedService> BuildTestHistoryService( 94 std::unique_ptr<KeyedService> BuildTestHistoryService(
92 content::BrowserContext* context) { 95 content::BrowserContext* context) {
93 std::unique_ptr<history::HistoryService> service( 96 std::unique_ptr<history::HistoryService> service(
94 new history::HistoryService()); 97 new history::HistoryService());
95 service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); 98 service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir));
96 return std::move(service); 99 return std::move(service);
97 } 100 }
98 101
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 base::Time later_in_day = current_day + base::TimeDelta::FromSeconds(30); 1418 base::Time later_in_day = current_day + base::TimeDelta::FromSeconds(30);
1416 clock->SetNow(later_in_day); 1419 clock->SetNow(later_in_day);
1417 service->AddPoints(origin, 3); 1420 service->AddPoints(origin, 3);
1418 1421
1419 last_engagement_time = base::Time::FromInternalValue( 1422 last_engagement_time = base::Time::FromInternalValue(
1420 profile()->GetPrefs()->GetInt64(prefs::kSiteEngagementLastUpdateTime)); 1423 profile()->GetPrefs()->GetInt64(prefs::kSiteEngagementLastUpdateTime));
1421 1424
1422 EXPECT_EQ(later_in_day, last_engagement_time); 1425 EXPECT_EQ(later_in_day, last_engagement_time);
1423 EXPECT_EQ(later_in_day, service->GetLastEngagementTime()); 1426 EXPECT_EQ(later_in_day, service->GetLastEngagementTime());
1424 } 1427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698