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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 for (int i = max_group_; i < num_groups_; i += incr) { | 190 for (int i = max_group_; i < num_groups_; i += incr) { |
191 notification_promo_.group_ = i; | 191 notification_promo_.group_ = i; |
192 EXPECT_FALSE(notification_promo_.CanShow()); | 192 EXPECT_FALSE(notification_promo_.CanShow()); |
193 } | 193 } |
194 | 194 |
195 // Test in-range groups. | 195 // Test in-range groups. |
196 for (int i = 0; i < max_group_; i += incr) { | 196 for (int i = 0; i < max_group_; i += incr) { |
197 notification_promo_.group_ = i; | 197 notification_promo_.group_ = i; |
198 EXPECT_TRUE(notification_promo_.CanShow()); | 198 EXPECT_TRUE(notification_promo_.CanShow()); |
199 } | 199 } |
| 200 |
| 201 // When max_group_ is 0, all groups pass. |
| 202 notification_promo_.max_group_ = 0; |
| 203 for (int i = 0; i < num_groups_; i += incr) { |
| 204 notification_promo_.group_ = i; |
| 205 EXPECT_TRUE(notification_promo_.CanShow()); |
| 206 } |
200 } | 207 } |
201 | 208 |
202 void TestViews() { | 209 void TestViews() { |
203 // Test out of range views. | 210 // Test out of range views. |
204 for (int i = max_views_; i < max_views_ * 2; ++i) { | 211 for (int i = max_views_; i < max_views_ * 2; ++i) { |
205 notification_promo_.views_ = i; | 212 notification_promo_.views_ = i; |
206 EXPECT_FALSE(notification_promo_.CanShow()); | 213 EXPECT_FALSE(notification_promo_.CanShow()); |
207 } | 214 } |
208 | 215 |
209 // Test in range views. | 216 // Test in range views. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 promo_test.TestIncrement(); | 415 promo_test.TestIncrement(); |
409 promo_test.TestGplus(); | 416 promo_test.TestGplus(); |
410 } | 417 } |
411 | 418 |
412 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { | 419 TEST_F(PromoResourceServiceTest, PromoServerURLTest) { |
413 GURL promo_server_url = NotificationPromo::PromoServerURL(); | 420 GURL promo_server_url = NotificationPromo::PromoServerURL(); |
414 EXPECT_FALSE(promo_server_url.is_empty()); | 421 EXPECT_FALSE(promo_server_url.is_empty()); |
415 EXPECT_TRUE(promo_server_url.SchemeIs("https")); | 422 EXPECT_TRUE(promo_server_url.SchemeIs("https")); |
416 // TODO(achuith): Test this better. | 423 // TODO(achuith): Test this better. |
417 } | 424 } |
OLD | NEW |