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

Side by Side Diff: chrome/browser/banners/app_banner_settings_helper_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: Lei Zhang's comments 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/banners/app_banner_metrics.h" 8 #include "chrome/browser/banners/app_banner_metrics.h"
9 #include "chrome/browser/banners/app_banner_settings_helper.h" 9 #include "chrome/browser/banners/app_banner_settings_helper.h"
10 #include "chrome/browser/engagement/site_engagement_service.h" 10 #include "chrome/browser/engagement/site_engagement_service.h"
(...skipping 12 matching lines...) Expand all
23 base::Time::Exploded exploded_reference_time; 23 base::Time::Exploded exploded_reference_time;
24 exploded_reference_time.year = 2015; 24 exploded_reference_time.year = 2015;
25 exploded_reference_time.month = 1; 25 exploded_reference_time.month = 1;
26 exploded_reference_time.day_of_month = 30; 26 exploded_reference_time.day_of_month = 30;
27 exploded_reference_time.day_of_week = 5; 27 exploded_reference_time.day_of_week = 5;
28 exploded_reference_time.hour = 11; 28 exploded_reference_time.hour = 11;
29 exploded_reference_time.minute = 0; 29 exploded_reference_time.minute = 0;
30 exploded_reference_time.second = 0; 30 exploded_reference_time.second = 0;
31 exploded_reference_time.millisecond = 0; 31 exploded_reference_time.millisecond = 0;
32 32
33 return base::Time::FromLocalExploded(exploded_reference_time); 33 base::Time out_time;
34 EXPECT_TRUE(
35 base::Time::FromLocalExploded(exploded_reference_time, &out_time));
36 return out_time;
34 } 37 }
35 38
36 bool IsWithinDay(base::Time time1, base::Time time2) { 39 bool IsWithinDay(base::Time time1, base::Time time2) {
37 return time1 - time2 < base::TimeDelta::FromDays(1) || 40 return time1 - time2 < base::TimeDelta::FromDays(1) ||
38 time2 - time1 < base::TimeDelta::FromDays(1); 41 time2 - time1 < base::TimeDelta::FromDays(1);
39 } 42 }
40 43
41 bool IsWithinHour(base::Time time1, base::Time time2) { 44 bool IsWithinHour(base::Time time1, base::Time time2) {
42 return time1 - time2 < base::TimeDelta::FromHours(1) || 45 return time1 - time2 < base::TimeDelta::FromHours(1) ||
43 time2 - time1 < base::TimeDelta::FromHours(1); 46 time2 - time1 < base::TimeDelta::FromHours(1);
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 EXPECT_FALSE(AppBannerSettingsHelper::ShouldShowBanner( 772 EXPECT_FALSE(AppBannerSettingsHelper::ShouldShowBanner(
770 web_contents(), url, kTestPackageName, fourth_day)); 773 web_contents(), url, kTestPackageName, fourth_day));
771 774
772 // Visit the site again; now it should be shown. 775 // Visit the site again; now it should be shown.
773 AppBannerSettingsHelper::RecordBannerCouldShowEvent( 776 AppBannerSettingsHelper::RecordBannerCouldShowEvent(
774 web_contents(), url, kTestPackageName, fifth_day, 777 web_contents(), url, kTestPackageName, fifth_day,
775 ui::PAGE_TRANSITION_TYPED); 778 ui::PAGE_TRANSITION_TYPED);
776 EXPECT_TRUE(AppBannerSettingsHelper::ShouldShowBanner( 779 EXPECT_TRUE(AppBannerSettingsHelper::ShouldShowBanner(
777 web_contents(), url, kTestPackageName, fifth_day)); 780 web_contents(), url, kTestPackageName, fifth_day));
778 } 781 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698