OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |