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

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

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files Created 5 years, 7 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
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_tokenizer.h" 10 #include "base/strings/string_tokenizer.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 message_loop_.message_loop_proxy())) {} 83 message_loop_.message_loop_proxy())) {}
84 84
85 UnregistrationRequestTest::~UnregistrationRequestTest() {} 85 UnregistrationRequestTest::~UnregistrationRequestTest() {}
86 86
87 void UnregistrationRequestTest::UnregistrationCallback( 87 void UnregistrationRequestTest::UnregistrationCallback(
88 UnregistrationRequest::Status status) { 88 UnregistrationRequest::Status status) {
89 callback_called_ = true; 89 callback_called_ = true;
90 status_ = status; 90 status_ = status;
91 } 91 }
92 92
93 void UnregistrationRequestTest::CreateRequest() { 93 void UnregistrationRequestTest::CreateRequest() {
fgorski 2015/05/13 18:32:41 add tests for instance id path.
jianli 2015/05/13 22:42:57 Done.
94 scoped_ptr<UnregistrationRequest::GCMRequestInfo> gcm_request_info(
95 new UnregistrationRequest::GCMRequestInfo);
96 gcm_request_info->android_id = kAndroidId;
97 gcm_request_info->security_token = kSecurityToken;
98 gcm_request_info->app_id = kAppId;
94 request_.reset(new UnregistrationRequest( 99 request_.reset(new UnregistrationRequest(
95 GURL(kRegistrationURL), 100 GURL(kRegistrationURL),
96 UnregistrationRequest::RequestInfo(kAndroidId, 101 gcm_request_info.Pass(),
97 kSecurityToken,
98 kAppId),
99 kDefaultBackoffPolicy, 102 kDefaultBackoffPolicy,
100 base::Bind(&UnregistrationRequestTest::UnregistrationCallback, 103 base::Bind(&UnregistrationRequestTest::UnregistrationCallback,
101 base::Unretained(this)), 104 base::Unretained(this)),
102 url_request_context_getter_.get(), 105 url_request_context_getter_.get(),
103 &recorder_)); 106 &recorder_));
104 } 107 }
105 108
106 void UnregistrationRequestTest::SetResponseStatusAndString( 109 void UnregistrationRequestTest::SetResponseStatusAndString(
107 net::HttpStatusCode status_code, 110 net::HttpStatusCode status_code,
108 const std::string& response_body) { 111 const std::string& response_body) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 EXPECT_FALSE(callback_called_); 289 EXPECT_FALSE(callback_called_);
287 290
288 SetResponseStatusAndString(net::HTTP_OK, kDeletedAppId); 291 SetResponseStatusAndString(net::HTTP_OK, kDeletedAppId);
289 CompleteFetch(); 292 CompleteFetch();
290 293
291 EXPECT_TRUE(callback_called_); 294 EXPECT_TRUE(callback_called_);
292 EXPECT_EQ(UnregistrationRequest::SUCCESS, status_); 295 EXPECT_EQ(UnregistrationRequest::SUCCESS, status_);
293 } 296 }
294 297
295 } // namespace gcm 298 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698