PushNotificationRegistration implements InternalRegistrationProgressListener { @Deprecated public void registerGCM(Context context, String defaultSenderId) throws ManifestValidator.InvalidManifestException { registerGCM(context, defaultSenderId, null); } PushNotificationRegistration(
            String appKey,
            PusherAndroidOptions options,
            PusherAndroidFactory factory,
            ManifestValidator manifestValidator
    ); @Deprecated void registerGCM(Context context, String defaultSenderId); @Deprecated void registerGCM(
            Context context,
            String defaultSenderId,
            final PushNotificationRegistrationListener registrationListener); @Deprecated void registerFCM(Context context, final PushNotificationRegistrationListener listener); @Deprecated void registerFCM(Context context); @Deprecated void subscribe(String interest); @Deprecated void subscribe(final String interest, final InterestSubscriptionChangeListener listener); @Deprecated void unsubscribe(String interest); @Deprecated void unsubscribe(final String interest, final InterestSubscriptionChangeListener listener); @Deprecated void setGCMListener(GCMPushNotificationReceivedListener listener); @Deprecated void setFCMListener(FCMPushNotificationReceivedListener listener); @Override void onSuccessfulRegistration(String clientId, Context context); @Override void onFailedRegistration(int statusCode, String reason); static String GCM_CALLED_INTENT_FILTER; static String TOKEN_EXTRA_KEY; }
@Test public void testRegisterGCMStartsBroadcastManagerAndIntentService() throws ManifestValidator.InvalidManifestException { registration.registerGCM(context, "senderId", registrationListener); Intent expectedIntent = new Intent(context, GCMRegistrationIntentService.class); Intent startedIntent = shadowOf(RuntimeEnvironment.application).getNextStartedService(); assertThat(startedIntent.getComponent(), equalTo(expectedIntent.getComponent())); Bundle extras = startedIntent.getExtras(); assertEquals("senderId", extras.getString("gcm_defaultSenderId")); ShadowLocalBroadcastManager localBroadcastManager = (ShadowLocalBroadcastManager) Shadow.extract(LocalBroadcastManager.getInstance(context)); List<ShadowLocalBroadcastManager.Wrapper> receivers = localBroadcastManager.getRegisteredBroadcastReceivers(); assertEquals(1, receivers.size()); }