Chromium Code Reviews| Index: chrome/browser/services/gcm/fake_gcm_profile_service.cc |
| diff --git a/chrome/browser/services/gcm/fake_gcm_profile_service.cc b/chrome/browser/services/gcm/fake_gcm_profile_service.cc |
| index b5bdb17f1432151ac7b9509bea12d73500e59cb3..c2f05eda599ad38d7c3dde779ba1c889f6256490 100644 |
| --- a/chrome/browser/services/gcm/fake_gcm_profile_service.cc |
| +++ b/chrome/browser/services/gcm/fake_gcm_profile_service.cc |
| @@ -111,7 +111,8 @@ KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) { |
| } |
| FakeGCMProfileService::FakeGCMProfileService(Profile* profile) |
| - : collect_(false) { |
| + : collect_(false), |
| + registration_count_(0) { |
| static_cast<PushMessagingServiceImpl*>(push_messaging_service()) |
| ->SetProfileForTesting(profile); |
| } |
| @@ -126,11 +127,17 @@ void FakeGCMProfileService::RegisterFinished( |
| last_registered_sender_ids_ = sender_ids; |
| } |
| + // Generate fake registration IDs with an incrementing count (even for the |
| + // same app_id - there's no caching), so tests can distinguish registrations. |
| + // The ID also encodes the number of sender IDs which is used by |
| + // GcmApiTest.RegisterValidation, but in the most common case of a single |
| + // sender ID, this component will be zero (to avoid rebasing existing tests). |
| + int registration_id = ++registration_count_ + 1000 * (sender_ids.size() - 1); |
|
fgorski
2014/12/08 22:36:59
why not?
int registration_id = registration_count_
johnme
2014/12/10 14:12:53
Ok, I've changed it to a simpler format:
sende
|
| + |
| CustomFakeGCMDriver* custom_driver = |
| static_cast<CustomFakeGCMDriver*>(driver()); |
| - custom_driver->OnRegisterFinished(app_id, |
| - base::UintToString(sender_ids.size()), |
| - GCMClient::SUCCESS); |
| + custom_driver->OnRegisterFinished(app_id, base::IntToString(registration_id), |
| + GCMClient::SUCCESS); |
| } |
| void FakeGCMProfileService::UnregisterFinished(const std::string& app_id) { |