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

Side by Side Diff: ios/chrome/browser/notification_promo_unittest.cc

Issue 2740673002: Prepare Chromium and Blink for ICU 59 (Closed)
Patch Set: revert sftnly roll; it's in another CL 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 unified diff | Download patch
« no previous file with comments | « content/renderer/android/email_detector.cc ('k') | net/ftp/ftp_util.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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 13 matching lines...) Expand all
24 24
25 namespace ios { 25 namespace ios {
26 26
27 namespace { 27 namespace {
28 28
29 const char kDateFormat[] = "dd MMM yyyy HH:mm:ss zzzz"; 29 const char kDateFormat[] = "dd MMM yyyy HH:mm:ss zzzz";
30 30
31 bool YearFromNow(double* date_epoch, std::string* date_string) { 31 bool YearFromNow(double* date_epoch, std::string* date_string) {
32 *date_epoch = (base::Time::Now() + base::TimeDelta::FromDays(365)).ToTimeT(); 32 *date_epoch = (base::Time::Now() + base::TimeDelta::FromDays(365)).ToTimeT();
33 33
34 // TODO(jungshik): Use an ICU date formatter wrapper if it's ok to depend
sdefresne 2017/03/15 08:57:59 For ios/ code we prefer to have TODO use the forma
35 // on base::i18n.
34 UErrorCode status = U_ZERO_ERROR; 36 UErrorCode status = U_ZERO_ERROR;
35 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat), 37 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat),
36 icu::Locale("en_US"), status); 38 icu::Locale("en_US"), status);
37 if (!U_SUCCESS(status))
38 return false;
39
40 icu::UnicodeString date_unicode_string; 39 icu::UnicodeString date_unicode_string;
41 simple_formatter.format(static_cast<UDate>(*date_epoch * 1000), 40 simple_formatter.format(static_cast<UDate>(*date_epoch * 1000),
42 date_unicode_string, status); 41 date_unicode_string, status);
43 if (!U_SUCCESS(status)) 42 if (U_FAILURE(status))
44 return false; 43 return false;
45 44
46 return base::UTF16ToUTF8(date_unicode_string.getBuffer(), 45 date_unicode_string.toUTF8String(*date_string);
47 static_cast<size_t>(date_unicode_string.length()), 46 return true;
48 date_string);
49 } 47 }
50 48
51 } // namespace 49 } // namespace
52 50
53 class NotificationPromoTest : public testing::Test { 51 class NotificationPromoTest : public testing::Test {
54 public: 52 public:
55 NotificationPromoTest() 53 NotificationPromoTest()
56 : notification_promo_(&local_state_), 54 : notification_promo_(&local_state_),
57 field_trial_list_(base::MakeUnique<base::FieldTrialList>( 55 field_trial_list_(base::MakeUnique<base::FieldTrialList>(
58 base::MakeUnique<base::MockEntropyProvider>())), 56 base::MakeUnique<base::MockEntropyProvider>())),
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 " \"promo_id\":0" 439 " \"promo_id\":0"
442 "}", 440 "}",
443 "What do you think of Chrome?", 441 "What do you think of Chrome?",
444 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. 442 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT.
445 0, 30, 30); 443 0, 30, 30);
446 InitPromoFromVariations(); 444 InitPromoFromVariations();
447 TestMigrationOfOldPrefs(); 445 TestMigrationOfOldPrefs();
448 } 446 }
449 447
450 } // namespace ios 448 } // namespace ios
OLDNEW
« no previous file with comments | « content/renderer/android/email_detector.cc ('k') | net/ftp/ftp_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698