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

Side by Side Diff: chrome/browser/services/gcm/fake_gcm_profile_service.cc

Issue 165993005: [GCM] Make sure GCM checkout logic is invoked when the profile is signed out (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/services/gcm/fake_gcm_profile_service.h" 5 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/browser/browser_context.h" 11 #include "content/public/browser/browser_context.h"
12 12
13 namespace gcm { 13 namespace gcm {
14 14
15 // static 15 // static
16 BrowserContextKeyedService* FakeGCMProfileService::Build( 16 BrowserContextKeyedService* FakeGCMProfileService::Build(
17 content::BrowserContext* context) { 17 content::BrowserContext* context) {
18 Profile* profile = static_cast<Profile*>(context); 18 Profile* profile = static_cast<Profile*>(context);
19 return new FakeGCMProfileService(profile); 19 return new FakeGCMProfileService(profile);
20 } 20 }
21 21
22 // static
23 void FakeGCMProfileService::EnableGCMForTesting() {
24 GCMProfileService::enable_gcm_for_testing_ = true;
25 }
26
27 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) 22 FakeGCMProfileService::FakeGCMProfileService(Profile* profile)
28 : GCMProfileService(profile), 23 : GCMProfileService(profile),
29 collect_(false) {} 24 collect_(false) {}
30 25
31 FakeGCMProfileService::~FakeGCMProfileService() {} 26 FakeGCMProfileService::~FakeGCMProfileService() {}
32 27
33 void FakeGCMProfileService::Register(const std::string& app_id, 28 void FakeGCMProfileService::Register(const std::string& app_id,
34 const std::vector<std::string>& sender_ids, 29 const std::vector<std::string>& sender_ids,
35 const std::string& cert, 30 const std::string& cert,
36 RegisterCallback callback) { 31 RegisterCallback callback) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 SendCallback callback) { 74 SendCallback callback) {
80 if (collect_) { 75 if (collect_) {
81 last_sent_message_ = message; 76 last_sent_message_ = message;
82 last_receiver_id_ = receiver_id; 77 last_receiver_id_ = receiver_id;
83 } 78 }
84 79
85 callback.Run(message.id, GCMClient::SUCCESS); 80 callback.Run(message.id, GCMClient::SUCCESS);
86 } 81 }
87 82
88 } // namespace gcm 83 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698