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

Issue 2859233002: [Android] Refactor our notification channel definitions (Closed)

Created:
3 years, 7 months ago by awdf
Modified:
3 years, 7 months ago
Reviewers:
Peter Beverloo
CC:
chromium-reviews, Peter Beverloo, mlamouri+watch-notifications_chromium.org, awdf+watch_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android] Refactor our notification channel definitions This refactor means we now have two kinds of channels: 1. PredefinedChannel, with a resId defining channel name. - This is what was previously known as ChannelDefinitions.Channel. - Can be converted to a channel when required. 2. Channel - a drop-in replacement for Android's NotificationChannel. - This is useful until we target O and can use NotificationChannel directly. - The ability to create a channel without a resId is required to allow site channels to be created in future. As part of this change it was necessary to convert the existing ChannelsInitializerTest to an instrumented test, as we can no longer access the resId now the code refers to Channels. Since the test is now instrumented, it makes sense to test against the real NotificationManager, especially to test the fragile code that uses reflection. Finally, I made the ChannelsDefinition class no longer instantiable, as it didn't make much sense. BUG=700377, 716503 Review-Url: https://codereview.chromium.org/2859233002 Cr-Commit-Position: refs/heads/master@{#471829} Committed: https://chromium.googlesource.com/chromium/src/+/19c23fdc0f568042d316dba0c9bd461e9e4e685b

Patch Set 1 #

Patch Set 2 : rebase #

Patch Set 3 : rebase #

Patch Set 4 : Change channel interface to class + fixup - HALWAY THROUGH #

Patch Set 5 : Use Channel class at NotificationManagerProxy level; PredefinedChannel elsewhere #

Patch Set 6 : whoops unit test should've been removed from java_sources #

Patch Set 7 : Fix up remaining unit tests #

Patch Set 8 : Remove now-unnecessary methods from MockNMProxy #

Total comments: 12

Patch Set 9 : Nits, and made ChannelsUpdaterTest more powerful again by mocking resources #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+426 lines, -272 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderFactory.java View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -4 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxyImpl.java View 1 2 3 4 5 6 7 8 6 chunks +30 lines, -15 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/Channel.java View 1 2 3 4 5 6 7 8 1 chunk +41 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitions.java View 1 2 3 4 5 6 7 8 4 chunks +25 lines, -18 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializer.java View 1 2 3 4 5 6 7 8 4 chunks +14 lines, -11 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdater.java View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java_sources.gni View 1 2 3 4 5 6 7 8 3 chunks +2 lines, -1 line 0 comments Download
A chrome/android/javatests/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java View 1 2 3 4 5 6 7 8 1 chunk +250 lines, -0 lines 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java View 1 2 3 4 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsInitializerTest.java View 1 2 3 1 chunk +0 lines, -170 lines 0 comments Download
M chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java View 1 2 3 4 5 6 7 8 5 chunks +37 lines, -25 lines 1 comment Download
M chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java View 1 2 3 4 5 6 7 5 chunks +17 lines, -23 lines 0 comments Download

Messages

Total messages: 21 (15 generated)
awdf
This is ready for review now
3 years, 7 months ago (2017-05-08 17:01:05 UTC) #13
Peter Beverloo
lgtm https://codereview.chromium.org/2859233002/diff/140001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java File chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java (right): https://codereview.chromium.org/2859233002/diff/140001/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java#newcode19 chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java:19: * http://developer.android.com/reference/android/app/NotificationManager.html</a> nit: use https. Also quotes around ...
3 years, 7 months ago (2017-05-09 13:02:54 UTC) #14
awdf
Fixed the nits and made ChannelsUpdaterTest test what it was testing before by mocking resources. ...
3 years, 7 months ago (2017-05-15 16:35:21 UTC) #15
Peter Beverloo
still lgtm, thanks! https://codereview.chromium.org/2859233002/diff/160001/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java File chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java (right): https://codereview.chromium.org/2859233002/diff/160001/chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java#newcode132 chrome/android/junit/src/org/chromium/chrome/browser/notifications/channels/ChannelsUpdaterTest.java:132: for (Channel ch : channels) { ...
3 years, 7 months ago (2017-05-15 16:41:47 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2859233002/160001
3 years, 7 months ago (2017-05-15 16:43:03 UTC) #18
commit-bot: I haz the power
3 years, 7 months ago (2017-05-15 18:13:08 UTC) #21
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/19c23fdc0f568042d316dba0c9bd...

Powered by Google App Engine
This is Rietveld 408576698