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

Side by Side Diff: remoting/host/token_validator_factory_impl_unittest.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> 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
« no previous file with comments | « remoting/host/token_validator_factory_impl.cc ('k') | remoting/host/touch_injector_win.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 // A set of unit tests for TokenValidatorFactoryImpl 5 // A set of unit tests for TokenValidatorFactoryImpl
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 std::string response_; 53 std::string response_;
54 }; 54 };
55 55
56 class SetResponseURLRequestContext: public net::TestURLRequestContext { 56 class SetResponseURLRequestContext: public net::TestURLRequestContext {
57 public: 57 public:
58 void SetResponse(const std::string& headers, const std::string& response) { 58 void SetResponse(const std::string& headers, const std::string& response) {
59 scoped_ptr<net::URLRequestJobFactoryImpl> factory = 59 scoped_ptr<net::URLRequestJobFactoryImpl> factory =
60 make_scoped_ptr(new net::URLRequestJobFactoryImpl()); 60 make_scoped_ptr(new net::URLRequestJobFactoryImpl());
61 factory->SetProtocolHandler( 61 factory->SetProtocolHandler(
62 "https", make_scoped_ptr(new FakeProtocolHandler(headers, response))); 62 "https", make_scoped_ptr(new FakeProtocolHandler(headers, response)));
63 context_storage_.set_job_factory(factory.Pass()); 63 context_storage_.set_job_factory(std::move(factory));
64 } 64 }
65 }; 65 };
66 66
67 } // namespace 67 } // namespace
68 68
69 namespace remoting { 69 namespace remoting {
70 70
71 class TokenValidatorFactoryImplTest : public testing::Test { 71 class TokenValidatorFactoryImplTest : public testing::Test {
72 public: 72 public:
73 TokenValidatorFactoryImplTest() : message_loop_(base::MessageLoop::TYPE_IO) {} 73 TokenValidatorFactoryImplTest() : message_loop_(base::MessageLoop::TYPE_IO) {}
(...skipping 10 matching lines...) Expand all
84 84
85 void DeleteOnFailureCallback(const std::string& shared_secret) { 85 void DeleteOnFailureCallback(const std::string& shared_secret) {
86 EXPECT_TRUE(shared_secret.empty()); 86 EXPECT_TRUE(shared_secret.empty());
87 token_validator_.reset(); 87 token_validator_.reset();
88 message_loop_.QuitWhenIdle(); 88 message_loop_.QuitWhenIdle();
89 } 89 }
90 90
91 protected: 91 protected:
92 void SetUp() override { 92 void SetUp() override {
93 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); 93 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair);
94 scoped_ptr<net::TestURLRequestContext> context(
95 new SetResponseURLRequestContext());
96 request_context_getter_ = new net::TestURLRequestContextGetter( 94 request_context_getter_ = new net::TestURLRequestContextGetter(
97 message_loop_.task_runner(), context.Pass()); 95 message_loop_.task_runner(),
96 make_scoped_ptr(new SetResponseURLRequestContext()));
98 ThirdPartyAuthConfig config; 97 ThirdPartyAuthConfig config;
99 config.token_url = GURL(kTokenUrl); 98 config.token_url = GURL(kTokenUrl);
100 config.token_validation_url = GURL(kTokenValidationUrl); 99 config.token_validation_url = GURL(kTokenValidationUrl);
101 config.token_validation_cert_issuer = kTokenValidationCertIssuer; 100 config.token_validation_cert_issuer = kTokenValidationCertIssuer;
102 token_validator_factory_.reset(new TokenValidatorFactoryImpl( 101 token_validator_factory_.reset(new TokenValidatorFactoryImpl(
103 config, key_pair_, request_context_getter_)); 102 config, key_pair_, request_context_getter_));
104 } 103 }
105 104
106 static std::string CreateResponse(const std::string& scope) { 105 static std::string CreateResponse(const std::string& scope) {
107 base::DictionaryValue response_dict; 106 base::DictionaryValue response_dict;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string()); 180 SetResponse(net::URLRequestTestJob::test_error_headers(), std::string());
182 181
183 token_validator_->ValidateThirdPartyToken( 182 token_validator_->ValidateThirdPartyToken(
184 kToken, base::Bind( 183 kToken, base::Bind(
185 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback, 184 &TokenValidatorFactoryImplTest::DeleteOnFailureCallback,
186 base::Unretained(this))); 185 base::Unretained(this)));
187 message_loop_.Run(); 186 message_loop_.Run();
188 } 187 }
189 188
190 } // namespace remoting 189 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/token_validator_factory_impl.cc ('k') | remoting/host/touch_injector_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698