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

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

Issue 2740673002: Prepare Chromium and Blink for ICU 59 (Closed)
Patch Set: revert accidental revert of sftnly roll during rebase 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 16 matching lines...) Expand all
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 UErrorCode status = U_ZERO_ERROR; 34 UErrorCode status = U_ZERO_ERROR;
35 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat), 35 icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat),
36 icu::Locale("en_US"), status); 36 icu::Locale("en_US"), status);
37 if (!U_SUCCESS(status))
38 return false;
39
40 icu::UnicodeString date_unicode_string; 37 icu::UnicodeString date_unicode_string;
41 simple_formatter.format(static_cast<UDate>(*date_epoch * 1000), 38 simple_formatter.format(static_cast<UDate>(*date_epoch * 1000),
42 date_unicode_string, status); 39 date_unicode_string, status);
43 if (!U_SUCCESS(status)) 40 if (U_FAILURE(status))
44 return false; 41 return false;
45 42
46 return base::UTF16ToUTF8(date_unicode_string.getBuffer(), 43 date_unicode_string.toUTF8String(*date_string);
47 static_cast<size_t>(date_unicode_string.length()), 44 return true;
48 date_string);
49 } 45 }
50 46
51 } // namespace 47 } // namespace
52 48
53 class NotificationPromoTest : public testing::Test { 49 class NotificationPromoTest : public testing::Test {
54 public: 50 public:
55 NotificationPromoTest() 51 NotificationPromoTest()
56 : notification_promo_(&local_state_), 52 : notification_promo_(&local_state_),
57 field_trial_list_(base::MakeUnique<base::FieldTrialList>( 53 field_trial_list_(base::MakeUnique<base::FieldTrialList>(
58 base::MakeUnique<base::MockEntropyProvider>())), 54 base::MakeUnique<base::MockEntropyProvider>())),
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 " \"promo_id\":0" 437 " \"promo_id\":0"
442 "}", 438 "}",
443 "What do you think of Chrome?", 439 "What do you think of Chrome?",
444 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. 440 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT.
445 0, 30, 30); 441 0, 30, 30);
446 InitPromoFromVariations(); 442 InitPromoFromVariations();
447 TestMigrationOfOldPrefs(); 443 TestMigrationOfOldPrefs();
448 } 444 }
449 445
450 } // namespace ios 446 } // 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