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

Side by Side Diff: remoting/test/access_token_fetcher_unittest.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/test/access_token_fetcher.h" 5 #include "remoting/test/access_token_fetcher.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const std::string& data, 72 const std::string& data,
73 net::HttpStatusCode code, 73 net::HttpStatusCode code,
74 net::URLRequestStatus::Status status); 74 net::URLRequestStatus::Status status);
75 75
76 // Used for result verification 76 // Used for result verification
77 std::string access_token_retrieved_; 77 std::string access_token_retrieved_;
78 std::string refresh_token_retrieved_; 78 std::string refresh_token_retrieved_;
79 79
80 private: 80 private:
81 net::FakeURLFetcherFactory url_fetcher_factory_; 81 net::FakeURLFetcherFactory url_fetcher_factory_;
82 scoped_ptr<base::MessageLoopForIO> message_loop_; 82 std::unique_ptr<base::MessageLoopForIO> message_loop_;
83 83
84 DISALLOW_COPY_AND_ASSIGN(AccessTokenFetcherTest); 84 DISALLOW_COPY_AND_ASSIGN(AccessTokenFetcherTest);
85 }; 85 };
86 86
87 AccessTokenFetcherTest::AccessTokenFetcherTest() 87 AccessTokenFetcherTest::AccessTokenFetcherTest()
88 : url_fetcher_factory_(nullptr) { 88 : url_fetcher_factory_(nullptr) {
89 } 89 }
90 90
91 AccessTokenFetcherTest::~AccessTokenFetcherTest() { 91 AccessTokenFetcherTest::~AccessTokenFetcherTest() {
92 } 92 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 TEST_F(AccessTokenFetcherTest, MultipleAccessTokenCalls) { 168 TEST_F(AccessTokenFetcherTest, MultipleAccessTokenCalls) {
169 SetFakeResponse(GaiaUrls::GetInstance()->oauth2_token_url(), 169 SetFakeResponse(GaiaUrls::GetInstance()->oauth2_token_url(),
170 kAuthCodeExchangeValidResponse, net::HTTP_OK, 170 kAuthCodeExchangeValidResponse, net::HTTP_OK,
171 net::URLRequestStatus::SUCCESS); 171 net::URLRequestStatus::SUCCESS);
172 172
173 SetFakeResponse(GaiaUrls::GetInstance()->oauth2_token_info_url(), 173 SetFakeResponse(GaiaUrls::GetInstance()->oauth2_token_info_url(),
174 kValidTokenInfoResponse, net::HTTP_OK, 174 kValidTokenInfoResponse, net::HTTP_OK,
175 net::URLRequestStatus::SUCCESS); 175 net::URLRequestStatus::SUCCESS);
176 176
177 scoped_ptr<base::RunLoop> run_loop; 177 std::unique_ptr<base::RunLoop> run_loop;
178 run_loop.reset(new base::RunLoop()); 178 run_loop.reset(new base::RunLoop());
179 AccessTokenCallback access_token_callback = 179 AccessTokenCallback access_token_callback =
180 base::Bind(&AccessTokenFetcherTest::OnAccessTokenRetrieved, 180 base::Bind(&AccessTokenFetcherTest::OnAccessTokenRetrieved,
181 base::Unretained(this), run_loop->QuitClosure()); 181 base::Unretained(this), run_loop->QuitClosure());
182 182
183 AccessTokenFetcher access_token_fetcher; 183 AccessTokenFetcher access_token_fetcher;
184 access_token_fetcher.GetAccessTokenFromAuthCode(kAuthCodeValue, 184 access_token_fetcher.GetAccessTokenFromAuthCode(kAuthCodeValue,
185 access_token_callback); 185 access_token_callback);
186 186
187 run_loop->Run(); 187 run_loop->Run();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 400
401 run_loop.Run(); 401 run_loop.Run();
402 402
403 // Our callback should have been called with empty strings. 403 // Our callback should have been called with empty strings.
404 EXPECT_TRUE(access_token_retrieved_.empty()); 404 EXPECT_TRUE(access_token_retrieved_.empty());
405 EXPECT_TRUE(refresh_token_retrieved_.empty()); 405 EXPECT_TRUE(refresh_token_retrieved_.empty());
406 } 406 }
407 407
408 } // namespace test 408 } // namespace test
409 } // namespace remoting 409 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/access_token_fetcher.cc ('k') | remoting/test/app_remoting_connected_client_fixture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698