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

Side by Side Diff: chrome/browser/chromeos/policy/upload_job_unittest.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/chromeos/policy/upload_job.h" 5 #include "chrome/browser/chromeos/policy/upload_job.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // OAuth2TokenService: 66 // OAuth2TokenService:
67 void FetchOAuth2Token(RequestImpl* request, 67 void FetchOAuth2Token(RequestImpl* request,
68 const std::string& account_id, 68 const std::string& account_id,
69 net::URLRequestContextGetter* getter, 69 net::URLRequestContextGetter* getter,
70 const std::string& client_id, 70 const std::string& client_id,
71 const std::string& client_secret, 71 const std::string& client_secret,
72 const ScopeSet& scopes) override; 72 const ScopeSet& scopes) override;
73 73
74 // OAuth2TokenService: 74 // OAuth2TokenService:
75 void InvalidateOAuth2Token(const std::string& account_id, 75 void InvalidateAccessTokenImpl(const std::string& account_id,
76 const std::string& client_id, 76 const std::string& client_id,
77 const ScopeSet& scopes, 77 const ScopeSet& scopes,
78 const std::string& access_token) override; 78 const std::string& access_token) override;
79 79
80 void AddTokenToQueue(const std::string& token); 80 void AddTokenToQueue(const std::string& token);
81 bool IsTokenValid(const std::string& token) const; 81 bool IsTokenValid(const std::string& token) const;
82 void SetTokenValid(const std::string& token); 82 void SetTokenValid(const std::string& token);
83 void SetTokenInvalid(const std::string& token); 83 void SetTokenInvalid(const std::string& token);
84 84
85 private: 85 private:
86 std::queue<std::string> token_replies_; 86 std::queue<std::string> token_replies_;
87 std::set<std::string> valid_tokens_; 87 std::set<std::string> valid_tokens_;
88 88
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 void MockOAuth2TokenService::SetTokenValid(const std::string& token) { 130 void MockOAuth2TokenService::SetTokenValid(const std::string& token) {
131 valid_tokens_.insert(token); 131 valid_tokens_.insert(token);
132 } 132 }
133 133
134 void MockOAuth2TokenService::SetTokenInvalid(const std::string& token) { 134 void MockOAuth2TokenService::SetTokenInvalid(const std::string& token) {
135 valid_tokens_.erase(token); 135 valid_tokens_.erase(token);
136 } 136 }
137 137
138 void MockOAuth2TokenService::InvalidateOAuth2Token( 138 void MockOAuth2TokenService::InvalidateAccessTokenImpl(
139 const std::string& account_id, 139 const std::string& account_id,
140 const std::string& client_id, 140 const std::string& client_id,
141 const ScopeSet& scopes, 141 const ScopeSet& scopes,
142 const std::string& access_token) { 142 const std::string& access_token) {
143 SetTokenInvalid(access_token); 143 SetTokenInvalid(access_token);
144 } 144 }
145 145
146 } // namespace 146 } // namespace
147 147
148 class UploadJobTestBase : public testing::Test, public UploadJob::Delegate { 148 class UploadJobTestBase : public testing::Test, public UploadJob::Delegate {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 "customfield2: CUSTOM2\r\n" 333 "customfield2: CUSTOM2\r\n"
334 "\r\n" 334 "\r\n"
335 "**||--||PAYLOAD2||--||**\r\n--" 335 "**||--||PAYLOAD2||--||**\r\n--"
336 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA--\r\n"); 336 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA--\r\n");
337 337
338 upload_job->Start(); 338 upload_job->Start();
339 run_loop_.Run(); 339 run_loop_.Run();
340 } 340 }
341 341
342 } // namespace policy 342 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/upload_job_impl.cc ('k') | chrome/browser/chromeos/settings/device_oauth2_token_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698