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

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

Issue 10704143: Allow max_group = 0 to pass all groups. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/web_resource/notification_promo.cc ('k') | no next file » | 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) 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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/web_resource/notification_promo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698