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

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

Issue 648623003: PushMessagingBrowserTest for registration success and failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Respond to the infobar asynchronously, like a user. Created 6 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // static 105 // static
106 KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) { 106 KeyedService* FakeGCMProfileService::Build(content::BrowserContext* context) {
107 Profile* profile = static_cast<Profile*>(context); 107 Profile* profile = static_cast<Profile*>(context);
108 FakeGCMProfileService* service = new FakeGCMProfileService(profile); 108 FakeGCMProfileService* service = new FakeGCMProfileService(profile);
109 service->SetDriverForTesting(new CustomFakeGCMDriver(service)); 109 service->SetDriverForTesting(new CustomFakeGCMDriver(service));
110 return service; 110 return service;
111 } 111 }
112 112
113 FakeGCMProfileService::FakeGCMProfileService(Profile* profile) 113 FakeGCMProfileService::FakeGCMProfileService(Profile* profile)
114 : collect_(false) {} 114 : collect_(false) {
115 static_cast<PushMessagingServiceImpl*>(push_messaging_service())
116 ->SetProfileForTesting(profile);
117 }
115 118
116 FakeGCMProfileService::~FakeGCMProfileService() {} 119 FakeGCMProfileService::~FakeGCMProfileService() {}
117 120
118 void FakeGCMProfileService::RegisterFinished( 121 void FakeGCMProfileService::RegisterFinished(
119 const std::string& app_id, 122 const std::string& app_id,
120 const std::vector<std::string>& sender_ids) { 123 const std::vector<std::string>& sender_ids) {
121 if (collect_) { 124 if (collect_) {
122 last_registered_app_id_ = app_id; 125 last_registered_app_id_ = app_id;
123 last_registered_sender_ids_ = sender_ids; 126 last_registered_sender_ids_ = sender_ids;
124 } 127 }
(...skipping 30 matching lines...) Expand all
155 static_cast<CustomFakeGCMDriver*>(driver()); 158 static_cast<CustomFakeGCMDriver*>(driver());
156 custom_driver->OnSendFinished(app_id, message.id, GCMClient::SUCCESS); 159 custom_driver->OnSendFinished(app_id, message.id, GCMClient::SUCCESS);
157 } 160 }
158 161
159 void FakeGCMProfileService::AddExpectedUnregisterResponse( 162 void FakeGCMProfileService::AddExpectedUnregisterResponse(
160 GCMClient::Result result) { 163 GCMClient::Result result) {
161 unregister_responses_.push_back(result); 164 unregister_responses_.push_back(result);
162 } 165 }
163 166
164 } // namespace gcm 167 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/push_messaging_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698