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

Issue 7655008: promo_resource_service fixes/cleanup for promos. (Closed)

Created:
9 years, 4 months ago by achuithb
Modified:
9 years, 3 months ago
CC:
chromium-reviews, estade+watch_chromium.org
Visibility:
Public.

Description

promo_resource_service fixes/cleanup for promos. Remove is_synced check in CanShowPromo. Add support for additional question param max_group_number. Fix a bug where group was reset everytime the promo resource was fetched. Breakup UnpackPromoSignal to a number of smaller helper functions for clarity, and so they can be individually unit-tested. Put all the logic of whether to display a promo into CanShowPromo. Get rid of unnecessary namespace PromoResourceServiceUtil. Make IsBuildTargeted private. Make GetChannel a private function in anonymous scope to consolidate duplicated comments/code. Delete unused web_resource_cache_. BUG=93201 TEST=Only relevant change is removal of is_synced check in CanShowPromo. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=101979

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 6

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Patch Set 12 : Fix unit tests #

Total comments: 4

Patch Set 13 : GetPromoStartTime #

Patch Set 14 : unit test for UnpackPromoSignal reentrancy #

Total comments: 5

Patch Set 15 : '' #

Patch Set 16 : '' #

Patch Set 17 : '' #

Patch Set 18 : SetPromoLine -> SetAdLine #

Patch Set 19 : GetPromoStartTime -> GetAdStartTime #

Patch Set 20 : rename Ad->Notification #

Total comments: 22

Patch Set 21 : round of fixing nits #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+305 lines, -162 lines) Patch
M chrome/browser/ui/webui/ntp/ntp_resource_cache.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -8 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 9 chunks +58 lines, -23 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 chunks +211 lines, -120 lines 2 comments Download
M chrome/browser/web_resource/promo_resource_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +29 lines, -10 lines 2 comments Download
M chrome/common/pref_names.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/pref_names.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 25 (0 generated)
achuithb
Please review. Thanks!
9 years, 4 months ago (2011-08-18 18:24:05 UTC) #1
Miranda Callahan
On 2011/08/18 18:24:05, achuith.bhandarkar wrote: > Please review. Thanks! This elegant refactoring really delights me ...
9 years, 4 months ago (2011-08-19 07:52:46 UTC) #2
jstritar
Thanks for the cleanup! LGTM http://codereview.chromium.org/7655008/diff/9002/chrome/browser/web_resource/promo_resource_service.cc File chrome/browser/web_resource/promo_resource_service.cc (right): http://codereview.chromium.org/7655008/diff/9002/chrome/browser/web_resource/promo_resource_service.cc#newcode453 chrome/browser/web_resource/promo_resource_service.cc:453: bool PromoResourceService::CanShowPromo(Profile* profile) { ...
9 years, 4 months ago (2011-08-19 14:56:13 UTC) #3
achuithb
Awaiting comments from Jon. Thanks Miranda and Jon for your feedback and LGTMs. http://codereview.chromium.org/7655008/diff/9002/chrome/browser/web_resource/promo_resource_service.cc File ...
9 years, 4 months ago (2011-08-19 20:16:14 UTC) #4
jstritar
LGTM still. http://codereview.chromium.org/7655008/diff/9002/chrome/browser/web_resource/promo_resource_service.cc File chrome/browser/web_resource/promo_resource_service.cc (right): http://codereview.chromium.org/7655008/diff/9002/chrome/browser/web_resource/promo_resource_service.cc#newcode453 chrome/browser/web_resource/promo_resource_service.cc:453: bool PromoResourceService::CanShowPromo(Profile* profile) { On 2011/08/19 20:16:14, ...
9 years, 4 months ago (2011-08-22 18:06:39 UTC) #5
achuithb
In retrospect, I should've probably checked in at the previous LGTM point and created a ...
9 years, 4 months ago (2011-08-23 01:29:18 UTC) #6
Miranda Callahan
On 2011/08/23 01:29:18, achuith.bhandarkar wrote: > In retrospect, I should've probably checked in at the ...
9 years, 4 months ago (2011-08-23 07:59:52 UTC) #7
Miranda Callahan
On 2011/08/23 07:59:52, Miranda Callahan wrote: > On 2011/08/23 01:29:18, achuith.bhandarkar wrote: > > In ...
9 years, 4 months ago (2011-08-23 08:32:04 UTC) #8
Miranda Callahan
Actually, a couple of nits -- the explanation of the fields in the .h file ...
9 years, 4 months ago (2011-08-23 08:33:31 UTC) #9
achuithb
I've made one more significant change, fixed a couple of nits, and added to the ...
9 years, 4 months ago (2011-08-23 21:38:55 UTC) #10
jstritar
http://codereview.chromium.org/7655008/diff/25002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc File chrome/browser/ui/webui/ntp/ntp_resource_cache.cc (right): http://codereview.chromium.org/7655008/diff/25002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc#newcode411 chrome/browser/ui/webui/ntp/ntp_resource_cache.cc:411: // the server, and this promo string exists, set ...
9 years, 4 months ago (2011-08-24 20:13:37 UTC) #11
Miranda Callahan
Ok, I went through and drew out a state diagram of this code, just as ...
9 years, 4 months ago (2011-08-25 08:23:29 UTC) #12
Miranda Callahan
http://codereview.chromium.org/7655008/diff/25002/chrome/browser/web_resource/promo_resource_service.h File chrome/browser/web_resource/promo_resource_service.h (right): http://codereview.chromium.org/7655008/diff/25002/chrome/browser/web_resource/promo_resource_service.h#newcode132 chrome/browser/web_resource/promo_resource_service.h:132: // For example, "7:24:5" would indicate that for 24 ...
9 years, 4 months ago (2011-08-25 08:23:38 UTC) #13
achuithb
This is going to be on hold for a day or two as I pursue ...
9 years, 4 months ago (2011-08-25 22:30:56 UTC) #14
Miranda Callahan
On 2011/08/25 22:30:56, achuith.bhandarkar wrote: > This is going to be on hold for a ...
9 years, 4 months ago (2011-08-26 07:37:08 UTC) #15
achuithb
I'm finally finished with the crasher that has kept me occupied the last two weeks. ...
9 years, 3 months ago (2011-09-12 18:43:52 UTC) #16
Miranda Callahan
On 2011/09/12 18:43:52, achuith.bhandarkar wrote: > I'm finally finished with the crasher that has kept ...
9 years, 3 months ago (2011-09-13 07:35:52 UTC) #17
achuithb
> Completely agree with deferring big-ticket items for a subsequent CL; though I > think ...
9 years, 3 months ago (2011-09-15 04:39:41 UTC) #18
Miranda Callahan
On 2011/09/15 04:39:41, achuith.bhandarkar wrote: > > Completely agree with deferring big-ticket items for a ...
9 years, 3 months ago (2011-09-15 08:18:41 UTC) #19
Miranda Callahan
http://codereview.chromium.org/7655008/diff/43002/chrome/browser/web_resource/promo_resource_service.cc File chrome/browser/web_resource/promo_resource_service.cc (right): http://codereview.chromium.org/7655008/diff/43002/chrome/browser/web_resource/promo_resource_service.cc#newcode235 chrome/browser/web_resource/promo_resource_service.cc:235: void PromoResourceService::UnpackAdSignal( nit:UnpackNotificationSignal http://codereview.chromium.org/7655008/diff/43002/chrome/browser/web_resource/promo_resource_service.h File chrome/browser/web_resource/promo_resource_service.h (right): http://codereview.chromium.org/7655008/diff/43002/chrome/browser/web_resource/promo_resource_service.h#newcode142 chrome/browser/web_resource/promo_resource_service.h:142: ...
9 years, 3 months ago (2011-09-15 08:21:30 UTC) #20
jstritar
http://codereview.chromium.org/7655008/diff/43002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc File chrome/browser/ui/webui/ntp/ntp_resource_cache.cc (right): http://codereview.chromium.org/7655008/diff/43002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc#newcode421 chrome/browser/ui/webui/ntp/ntp_resource_cache.cc:421: if (PromoResourceService::CanShowPromo(profile_)) { nit: CanShowNotificationPromo http://codereview.chromium.org/7655008/diff/43002/chrome/browser/web_resource/promo_resource_service.cc File chrome/browser/web_resource/promo_resource_service.cc (right): ...
9 years, 3 months ago (2011-09-15 15:42:27 UTC) #21
achuithb
Fixed nits, PTAL. http://codereview.chromium.org/7655008/diff/43002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc File chrome/browser/ui/webui/ntp/ntp_resource_cache.cc (right): http://codereview.chromium.org/7655008/diff/43002/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc#newcode421 chrome/browser/ui/webui/ntp/ntp_resource_cache.cc:421: if (PromoResourceService::CanShowPromo(profile_)) { On 2011/09/15 15:42:27, ...
9 years, 3 months ago (2011-09-15 18:58:13 UTC) #22
achuithb
jstritar: ping?
9 years, 3 months ago (2011-09-19 22:15:05 UTC) #23
jstritar
LGTM http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource/promo_resource_service.cc File chrome/browser/web_resource/promo_resource_service.cc (right): http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource/promo_resource_service.cc#newcode332 chrome/browser/web_resource/promo_resource_service.cc:332: } nit: new line http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource/promo_resource_service_unittest.cc File chrome/browser/web_resource/promo_resource_service_unittest.cc (right): ...
9 years, 3 months ago (2011-09-19 22:20:54 UTC) #24
achuithb
9 years, 3 months ago (2011-09-19 22:57:56 UTC) #25
I'm going to land this with your LGTM. I've added an AI to test
CanShowNotificationPromo in 96290 and will address this with the next CL.

http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource...
File chrome/browser/web_resource/promo_resource_service.cc (right):

http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource...
chrome/browser/web_resource/promo_resource_service.cc:332: }
On 2011/09/19 22:20:54, jstritar wrote:
> nit: new line

Done.

http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource...
File chrome/browser/web_resource/promo_resource_service_unittest.cc (right):

http://codereview.chromium.org/7655008/diff/48003/chrome/browser/web_resource...
chrome/browser/web_resource/promo_resource_service_unittest.cc:185:
EXPECT_EQ(promo_end, prefs->GetDouble(prefs::kNTPPromoEnd));
On 2011/09/19 22:20:54, jstritar wrote:
> Maybe test CanShowNotificationPromo? You could try with an in-range and
> out-of-range group number?

I can't because of the build check in CanShowNotificationPromo.

I need to either have a way to separate out the build check of
CanShowNotificationPromo, or even better, as you once suggested, do the build
check during the parse stage and not in CanShowNotificationPromo. I've added an
action item to crbug.com/96290 to test CanShowNotificationPromo.

Powered by Google App Engine
This is Rietveld 408576698