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

Side by Side Diff: sync/internal_api/attachments/attachment_uploader_impl_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
« no previous file with comments | « sync/internal_api/attachments/attachment_downloader_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/internal_api/public/attachments/attachment_uploader_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 protected: 85 protected:
86 void FetchOAuth2Token(RequestImpl* request, 86 void FetchOAuth2Token(RequestImpl* request,
87 const std::string& account_id, 87 const std::string& account_id,
88 net::URLRequestContextGetter* getter, 88 net::URLRequestContextGetter* getter,
89 const std::string& client_id, 89 const std::string& client_id,
90 const std::string& client_secret, 90 const std::string& client_secret,
91 const ScopeSet& scopes) override; 91 const ScopeSet& scopes) override;
92 92
93 void InvalidateOAuth2Token(const std::string& account_id, 93 void InvalidateAccessTokenImpl(const std::string& account_id,
94 const std::string& client_id, 94 const std::string& client_id,
95 const ScopeSet& scopes, 95 const ScopeSet& scopes,
96 const std::string& access_token) override; 96 const std::string& access_token) override;
97 97
98 private: 98 private:
99 GoogleServiceAuthError response_error_; 99 GoogleServiceAuthError response_error_;
100 std::string response_access_token_; 100 std::string response_access_token_;
101 base::Time response_expiration_; 101 base::Time response_expiration_;
102 int num_invalidate_token_; 102 int num_invalidate_token_;
103 std::string last_token_invalidated_; 103 std::string last_token_invalidated_;
104 }; 104 };
105 105
106 MockOAuth2TokenService::MockOAuth2TokenService() 106 MockOAuth2TokenService::MockOAuth2TokenService()
(...skipping 23 matching lines...) Expand all
130 const ScopeSet& scopes) { 130 const ScopeSet& scopes) {
131 base::MessageLoop::current()->PostTask( 131 base::MessageLoop::current()->PostTask(
132 FROM_HERE, 132 FROM_HERE,
133 base::Bind(&OAuth2TokenService::RequestImpl::InformConsumer, 133 base::Bind(&OAuth2TokenService::RequestImpl::InformConsumer,
134 request->AsWeakPtr(), 134 request->AsWeakPtr(),
135 response_error_, 135 response_error_,
136 response_access_token_, 136 response_access_token_,
137 response_expiration_)); 137 response_expiration_));
138 } 138 }
139 139
140 void MockOAuth2TokenService::InvalidateOAuth2Token( 140 void MockOAuth2TokenService::InvalidateAccessTokenImpl(
141 const std::string& account_id, 141 const std::string& account_id,
142 const std::string& client_id, 142 const std::string& client_id,
143 const ScopeSet& scopes, 143 const ScopeSet& scopes,
144 const std::string& access_token) { 144 const std::string& access_token) {
145 ++num_invalidate_token_; 145 ++num_invalidate_token_;
146 last_token_invalidated_ = access_token; 146 last_token_invalidated_ = access_token;
147 } 147 }
148 148
149 class TokenServiceProvider 149 class TokenServiceProvider
150 : public OAuth2TokenServiceRequest::TokenServiceProvider, 150 : public OAuth2TokenServiceRequest::TokenServiceProvider,
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); 671 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString);
672 hello_world->data() = "hello world"; 672 hello_world->data() = "hello world";
673 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( 673 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash(
674 ComputeCrc32c(hello_world))); 674 ComputeCrc32c(hello_world)));
675 } 675 }
676 676
677 // TODO(maniscalco): Add test case for when we are uploading an attachment that 677 // TODO(maniscalco): Add test case for when we are uploading an attachment that
678 // already exists. 409 Conflict? (bug 379825) 678 // already exists. 409 Conflict? (bug 379825)
679 679
680 } // namespace syncer 680 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/attachments/attachment_downloader_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698