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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service_unittest.cc

Issue 1227413007: Move ReplaceStringPlaceholders to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@join
Patch Set: Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int num_groups, int initial_segment, int increment, 86 int num_groups, int initial_segment, int increment,
87 int time_slice, int max_group, int max_views) { 87 int time_slice, int max_group, int max_views) {
88 double year_from_now_epoch; 88 double year_from_now_epoch;
89 std::string year_from_now_string; 89 std::string year_from_now_string;
90 ASSERT_TRUE(YearFromNow(&year_from_now_epoch, &year_from_now_string)); 90 ASSERT_TRUE(YearFromNow(&year_from_now_epoch, &year_from_now_string));
91 91
92 std::vector<std::string> replacements; 92 std::vector<std::string> replacements;
93 replacements.push_back(year_from_now_string); 93 replacements.push_back(year_from_now_string);
94 94
95 std::string json_with_end_date( 95 std::string json_with_end_date(
96 ReplaceStringPlaceholders(json, replacements, NULL)); 96 base::ReplaceStringPlaceholders(json, replacements, NULL));
97 base::Value* value(base::JSONReader::DeprecatedRead(json_with_end_date)); 97 base::Value* value(base::JSONReader::DeprecatedRead(json_with_end_date));
98 ASSERT_TRUE(value); 98 ASSERT_TRUE(value);
99 99
100 base::DictionaryValue* dict = NULL; 100 base::DictionaryValue* dict = NULL;
101 value->GetAsDictionary(&dict); 101 value->GetAsDictionary(&dict);
102 ASSERT_TRUE(dict); 102 ASSERT_TRUE(dict);
103 test_json_.reset(dict); 103 test_json_.reset(dict);
104 104
105 promo_type_ = NotificationPromo::NTP_NOTIFICATION_PROMO; 105 promo_type_ = NotificationPromo::NTP_NOTIFICATION_PROMO;
106 promo_text_ = promo_text; 106 promo_text_ = promo_text;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 "What do you think of Chrome?", 570 "What do you think of Chrome?",
571 // The starting date is in 1999 to make tests pass 571 // The starting date is in 1999 to make tests pass
572 // on Android devices with incorrect or unset date/time. 572 // on Android devices with incorrect or unset date/time.
573 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. 573 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT.
574 1000, 200, 100, 3600, 400, 30); 574 1000, 200, 100, 3600, 400, 30);
575 promo_test.InitPromoFromJson(true); 575 promo_test.InitPromoFromJson(true);
576 local_state_.Get()->SetBoolean(prefs::kAppLauncherHasBeenEnabled, true); 576 local_state_.Get()->SetBoolean(prefs::kAppLauncherHasBeenEnabled, true);
577 EXPECT_FALSE(promo_test.promo().CanShow()); 577 EXPECT_FALSE(promo_test.promo().CanShow());
578 } 578 }
579 #endif 579 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | chrome/installer/util/google_chrome_distribution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698