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

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

Issue 1547233002: Convert Pass()→std::move() in //google_apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 <stdint.h> 5 #include <stdint.h>
6
7 #include <map> 6 #include <map>
8 #include <string> 7 #include <string>
8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_tokenizer.h" 12 #include "base/strings/string_tokenizer.h"
13 #include "google_apis/gcm/engine/gcm_registration_request_handler.h" 13 #include "google_apis/gcm/engine/gcm_registration_request_handler.h"
14 #include "google_apis/gcm/engine/gcm_request_test_base.h" 14 #include "google_apis/gcm/engine/gcm_request_test_base.h"
15 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h" 15 #include "google_apis/gcm/engine/instance_id_get_token_request_handler.h"
16 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" 16 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
17 #include "net/base/escape.h" 17 #include "net/base/escape.h"
18 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 GCMRegistrationRequestTest::~GCMRegistrationRequestTest() { 95 GCMRegistrationRequestTest::~GCMRegistrationRequestTest() {
96 } 96 }
97 97
98 void GCMRegistrationRequestTest::CreateRequest(const std::string& sender_ids) { 98 void GCMRegistrationRequestTest::CreateRequest(const std::string& sender_ids) {
99 RegistrationRequest::RequestInfo request_info( 99 RegistrationRequest::RequestInfo request_info(
100 kAndroidId, kSecurityToken, kAppId); 100 kAndroidId, kSecurityToken, kAppId);
101 scoped_ptr<GCMRegistrationRequestHandler> request_handler( 101 scoped_ptr<GCMRegistrationRequestHandler> request_handler(
102 new GCMRegistrationRequestHandler(sender_ids)); 102 new GCMRegistrationRequestHandler(sender_ids));
103 request_.reset(new RegistrationRequest( 103 request_.reset(new RegistrationRequest(
104 GURL(kRegistrationURL), 104 GURL(kRegistrationURL), request_info, std::move(request_handler),
105 request_info,
106 request_handler.Pass(),
107 GetBackoffPolicy(), 105 GetBackoffPolicy(),
108 base::Bind(&RegistrationRequestTest::RegistrationCallback, 106 base::Bind(&RegistrationRequestTest::RegistrationCallback,
109 base::Unretained(this)), 107 base::Unretained(this)),
110 max_retry_count_, 108 max_retry_count_, url_request_context_getter(), &recorder_, sender_ids));
111 url_request_context_getter(),
112 &recorder_,
113 sender_ids));
114 } 109 }
115 110
116 TEST_F(GCMRegistrationRequestTest, RequestSuccessful) { 111 TEST_F(GCMRegistrationRequestTest, RequestSuccessful) {
117 set_max_retry_count(0); 112 set_max_retry_count(0);
118 CreateRequest("sender1,sender2"); 113 CreateRequest("sender1,sender2");
119 request_->Start(); 114 request_->Start();
120 115
121 SetResponse(net::HTTP_OK, "token=2501"); 116 SetResponse(net::HTTP_OK, "token=2501");
122 CompleteFetch(); 117 CompleteFetch();
123 118
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 const std::string& instance_id, 412 const std::string& instance_id,
418 const std::string& authorized_entity, 413 const std::string& authorized_entity,
419 const std::string& scope, 414 const std::string& scope,
420 const std::map<std::string, std::string>& options) { 415 const std::map<std::string, std::string>& options) {
421 RegistrationRequest::RequestInfo request_info( 416 RegistrationRequest::RequestInfo request_info(
422 kAndroidId, kSecurityToken, kAppId); 417 kAndroidId, kSecurityToken, kAppId);
423 scoped_ptr<InstanceIDGetTokenRequestHandler> request_handler( 418 scoped_ptr<InstanceIDGetTokenRequestHandler> request_handler(
424 new InstanceIDGetTokenRequestHandler( 419 new InstanceIDGetTokenRequestHandler(
425 instance_id, authorized_entity, scope, kGCMVersion, options)); 420 instance_id, authorized_entity, scope, kGCMVersion, options));
426 request_.reset(new RegistrationRequest( 421 request_.reset(new RegistrationRequest(
427 GURL(kRegistrationURL), 422 GURL(kRegistrationURL), request_info, std::move(request_handler),
428 request_info,
429 request_handler.Pass(),
430 GetBackoffPolicy(), 423 GetBackoffPolicy(),
431 base::Bind(&RegistrationRequestTest::RegistrationCallback, 424 base::Bind(&RegistrationRequestTest::RegistrationCallback,
432 base::Unretained(this)), 425 base::Unretained(this)),
433 max_retry_count_, 426 max_retry_count_, url_request_context_getter(), &recorder_,
434 url_request_context_getter(),
435 &recorder_,
436 authorized_entity)); 427 authorized_entity));
437 } 428 }
438 429
439 TEST_F(InstanceIDGetTokenRequestTest, RequestSuccessful) { 430 TEST_F(InstanceIDGetTokenRequestTest, RequestSuccessful) {
440 std::map<std::string, std::string> options; 431 std::map<std::string, std::string> options;
441 options["Foo"] = "Bar"; 432 options["Foo"] = "Bar";
442 433
443 set_max_retry_count(0); 434 set_max_retry_count(0);
444 CreateRequest(kInstanceId, kDeveloperId, kScope, options); 435 CreateRequest(kInstanceId, kDeveloperId, kScope, options);
445 request_->Start(); 436 request_->Start();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 512
522 SetResponse(net::HTTP_OK, "token=2501"); 513 SetResponse(net::HTTP_OK, "token=2501");
523 CompleteFetch(); 514 CompleteFetch();
524 515
525 EXPECT_TRUE(callback_called_); 516 EXPECT_TRUE(callback_called_);
526 EXPECT_EQ(RegistrationRequest::SUCCESS, status_); 517 EXPECT_EQ(RegistrationRequest::SUCCESS, status_);
527 EXPECT_EQ("2501", registration_id_); 518 EXPECT_EQ("2501", registration_id_);
528 } 519 }
529 520
530 } // namespace gcm 521 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/registration_request.cc ('k') | google_apis/gcm/engine/unregistration_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698