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

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

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void set_max_retry_count(int max_retry_count) { 47 void set_max_retry_count(int max_retry_count) {
48 max_retry_count_ = max_retry_count; 48 max_retry_count_ = max_retry_count;
49 } 49 }
50 50
51 protected: 51 protected:
52 int max_retry_count_; 52 int max_retry_count_;
53 RegistrationRequest::Status status_; 53 RegistrationRequest::Status status_;
54 std::string registration_id_; 54 std::string registration_id_;
55 bool callback_called_; 55 bool callback_called_;
56 std::map<std::string, std::string> extras_; 56 std::map<std::string, std::string> extras_;
57 scoped_ptr<RegistrationRequest> request_; 57 std::unique_ptr<RegistrationRequest> request_;
58 FakeGCMStatsRecorder recorder_; 58 FakeGCMStatsRecorder recorder_;
59 }; 59 };
60 60
61 RegistrationRequestTest::RegistrationRequestTest() 61 RegistrationRequestTest::RegistrationRequestTest()
62 : max_retry_count_(2), 62 : max_retry_count_(2),
63 status_(RegistrationRequest::SUCCESS), 63 status_(RegistrationRequest::SUCCESS),
64 callback_called_(false) {} 64 callback_called_(false) {}
65 65
66 RegistrationRequestTest::~RegistrationRequestTest() {} 66 RegistrationRequestTest::~RegistrationRequestTest() {}
67 67
(...skipping 23 matching lines...) Expand all
91 91
92 GCMRegistrationRequestTest::GCMRegistrationRequestTest() { 92 GCMRegistrationRequestTest::GCMRegistrationRequestTest() {
93 } 93 }
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 std::unique_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), request_info, std::move(request_handler), 104 GURL(kRegistrationURL), request_info, std::move(request_handler),
105 GetBackoffPolicy(), 105 GetBackoffPolicy(),
106 base::Bind(&RegistrationRequestTest::RegistrationCallback, 106 base::Bind(&RegistrationRequestTest::RegistrationCallback,
107 base::Unretained(this)), 107 base::Unretained(this)),
108 max_retry_count_, url_request_context_getter(), &recorder_, sender_ids)); 108 max_retry_count_, url_request_context_getter(), &recorder_, sender_ids));
109 } 109 }
110 110
111 TEST_F(GCMRegistrationRequestTest, RequestSuccessful) { 111 TEST_F(GCMRegistrationRequestTest, RequestSuccessful) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 InstanceIDGetTokenRequestTest::~InstanceIDGetTokenRequestTest() { 410 InstanceIDGetTokenRequestTest::~InstanceIDGetTokenRequestTest() {
411 } 411 }
412 412
413 void InstanceIDGetTokenRequestTest::CreateRequest( 413 void InstanceIDGetTokenRequestTest::CreateRequest(
414 const std::string& instance_id, 414 const std::string& instance_id,
415 const std::string& authorized_entity, 415 const std::string& authorized_entity,
416 const std::string& scope, 416 const std::string& scope,
417 const std::map<std::string, std::string>& options) { 417 const std::map<std::string, std::string>& options) {
418 RegistrationRequest::RequestInfo request_info( 418 RegistrationRequest::RequestInfo request_info(
419 kAndroidId, kSecurityToken, kAppId); 419 kAndroidId, kSecurityToken, kAppId);
420 scoped_ptr<InstanceIDGetTokenRequestHandler> request_handler( 420 std::unique_ptr<InstanceIDGetTokenRequestHandler> request_handler(
421 new InstanceIDGetTokenRequestHandler( 421 new InstanceIDGetTokenRequestHandler(instance_id, authorized_entity,
422 instance_id, authorized_entity, scope, kGCMVersion, options)); 422 scope, kGCMVersion, options));
423 request_.reset(new RegistrationRequest( 423 request_.reset(new RegistrationRequest(
424 GURL(kRegistrationURL), request_info, std::move(request_handler), 424 GURL(kRegistrationURL), request_info, std::move(request_handler),
425 GetBackoffPolicy(), 425 GetBackoffPolicy(),
426 base::Bind(&RegistrationRequestTest::RegistrationCallback, 426 base::Bind(&RegistrationRequestTest::RegistrationCallback,
427 base::Unretained(this)), 427 base::Unretained(this)),
428 max_retry_count_, url_request_context_getter(), &recorder_, 428 max_retry_count_, url_request_context_getter(), &recorder_,
429 authorized_entity)); 429 authorized_entity));
430 } 430 }
431 431
432 TEST_F(InstanceIDGetTokenRequestTest, RequestSuccessful) { 432 TEST_F(InstanceIDGetTokenRequestTest, RequestSuccessful) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 SetResponse(net::HTTP_OK, "token=2501"); 515 SetResponse(net::HTTP_OK, "token=2501");
516 CompleteFetch(); 516 CompleteFetch();
517 517
518 EXPECT_TRUE(callback_called_); 518 EXPECT_TRUE(callback_called_);
519 EXPECT_EQ(RegistrationRequest::SUCCESS, status_); 519 EXPECT_EQ(RegistrationRequest::SUCCESS, status_);
520 EXPECT_EQ("2501", registration_id_); 520 EXPECT_EQ("2501", registration_id_);
521 } 521 }
522 522
523 } // namespace gcm 523 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698