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

Side by Side Diff: google_apis/gcm/engine/unregistration_request_unittest.cc

Issue 2434243002: GCM Engine: Split up reg/unreg UNKNOWN_ERROR to improve metrics (Closed)
Patch Set: mid-cycle -> mid-beta Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 #include <map> 6 #include <map>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 CreateRequest(); 190 CreateRequest();
191 request_->Start(); 191 request_->Start();
192 192
193 SetResponse(net::HTTP_OK, "Error=INVALID_PARAMETERS"); 193 SetResponse(net::HTTP_OK, "Error=INVALID_PARAMETERS");
194 CompleteFetch(); 194 CompleteFetch();
195 195
196 EXPECT_TRUE(callback_called_); 196 EXPECT_TRUE(callback_called_);
197 EXPECT_EQ(UnregistrationRequest::INVALID_PARAMETERS, status_); 197 EXPECT_EQ(UnregistrationRequest::INVALID_PARAMETERS, status_);
198 } 198 }
199 199
200 TEST_F(GCMUnregistrationRequestTest, DeviceRegistrationError) {
201 CreateRequest();
202 request_->Start();
203
204 SetResponse(net::HTTP_OK, "Error=PHONE_REGISTRATION_ERROR");
205 CompleteFetch();
206
207 EXPECT_TRUE(callback_called_);
208 EXPECT_EQ(UnregistrationRequest::DEVICE_REGISTRATION_ERROR, status_);
209 }
210
200 TEST_F(GCMUnregistrationRequestTest, UnkwnownError) { 211 TEST_F(GCMUnregistrationRequestTest, UnkwnownError) {
201 CreateRequest(); 212 CreateRequest();
202 request_->Start(); 213 request_->Start();
203 214
204 SetResponse(net::HTTP_OK, "Error=XXX"); 215 SetResponse(net::HTTP_OK, "Error=XXX");
205 CompleteFetch(); 216 CompleteFetch();
206 217
207 EXPECT_TRUE(callback_called_); 218 EXPECT_TRUE(callback_called_);
208 EXPECT_EQ(UnregistrationRequest::UNKNOWN_ERROR, status_); 219 EXPECT_EQ(UnregistrationRequest::UNKNOWN_ERROR, status_);
209 } 220 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 request_->Start(); 456 request_->Start();
446 457
447 SetResponse(net::HTTP_OK, "Error=XXX"); 458 SetResponse(net::HTTP_OK, "Error=XXX");
448 CompleteFetch(); 459 CompleteFetch();
449 460
450 EXPECT_TRUE(callback_called_); 461 EXPECT_TRUE(callback_called_);
451 EXPECT_EQ(UnregistrationRequest::UNKNOWN_ERROR, status_); 462 EXPECT_EQ(UnregistrationRequest::UNKNOWN_ERROR, status_);
452 } 463 }
453 464
454 } // namespace gcm 465 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/unregistration_request.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698