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

Side by Side Diff: sync/internal_api/attachments/attachment_uploader_impl_unittest.cc

Issue 642023004: Standardize usage of virtual/override/final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // A mock implementation of an OAuth2TokenService. 52 // A mock implementation of an OAuth2TokenService.
53 // 53 //
54 // Use |SetResponse| to vary the response to token requests. 54 // Use |SetResponse| to vary the response to token requests.
55 // 55 //
56 // Use |num_invalidate_token| and |last_token_invalidated| to check the number 56 // Use |num_invalidate_token| and |last_token_invalidated| to check the number
57 // of invalidate token operations performed and the last token invalidated. 57 // of invalidate token operations performed and the last token invalidated.
58 class MockOAuth2TokenService : public FakeOAuth2TokenService { 58 class MockOAuth2TokenService : public FakeOAuth2TokenService {
59 public: 59 public:
60 MockOAuth2TokenService(); 60 MockOAuth2TokenService();
61 virtual ~MockOAuth2TokenService(); 61 ~MockOAuth2TokenService() override;
62 62
63 void SetResponse(const GoogleServiceAuthError& error, 63 void SetResponse(const GoogleServiceAuthError& error,
64 const std::string& access_token, 64 const std::string& access_token,
65 const base::Time& expiration); 65 const base::Time& expiration);
66 66
67 int num_invalidate_token() const { return num_invalidate_token_; } 67 int num_invalidate_token() const { return num_invalidate_token_; }
68 68
69 const std::string& last_token_invalidated() const { 69 const std::string& last_token_invalidated() const {
70 return last_token_invalidated_; 70 return last_token_invalidated_;
71 } 71 }
72 72
73 protected: 73 protected:
74 virtual void FetchOAuth2Token(RequestImpl* request, 74 void FetchOAuth2Token(RequestImpl* request,
75 const std::string& account_id, 75 const std::string& account_id,
76 net::URLRequestContextGetter* getter, 76 net::URLRequestContextGetter* getter,
77 const std::string& client_id, 77 const std::string& client_id,
78 const std::string& client_secret, 78 const std::string& client_secret,
79 const ScopeSet& scopes) override; 79 const ScopeSet& scopes) override;
80 80
81 virtual void InvalidateOAuth2Token(const std::string& account_id, 81 void InvalidateOAuth2Token(const std::string& account_id,
82 const std::string& client_id, 82 const std::string& client_id,
83 const ScopeSet& scopes, 83 const ScopeSet& scopes,
84 const std::string& access_token) override; 84 const std::string& access_token) override;
85 85
86 private: 86 private:
87 GoogleServiceAuthError response_error_; 87 GoogleServiceAuthError response_error_;
88 std::string response_access_token_; 88 std::string response_access_token_;
89 base::Time response_expiration_; 89 base::Time response_expiration_;
90 int num_invalidate_token_; 90 int num_invalidate_token_;
91 std::string last_token_invalidated_; 91 std::string last_token_invalidated_;
92 }; 92 };
93 93
94 MockOAuth2TokenService::MockOAuth2TokenService() 94 MockOAuth2TokenService::MockOAuth2TokenService()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 last_token_invalidated_ = access_token; 134 last_token_invalidated_ = access_token;
135 } 135 }
136 136
137 class TokenServiceProvider 137 class TokenServiceProvider
138 : public OAuth2TokenServiceRequest::TokenServiceProvider, 138 : public OAuth2TokenServiceRequest::TokenServiceProvider,
139 base::NonThreadSafe { 139 base::NonThreadSafe {
140 public: 140 public:
141 TokenServiceProvider(OAuth2TokenService* token_service); 141 TokenServiceProvider(OAuth2TokenService* token_service);
142 142
143 // OAuth2TokenService::TokenServiceProvider implementation. 143 // OAuth2TokenService::TokenServiceProvider implementation.
144 virtual scoped_refptr<base::SingleThreadTaskRunner> 144 scoped_refptr<base::SingleThreadTaskRunner> GetTokenServiceTaskRunner()
145 GetTokenServiceTaskRunner() override; 145 override;
146 virtual OAuth2TokenService* GetTokenService() override; 146 OAuth2TokenService* GetTokenService() override;
147 147
148 private: 148 private:
149 virtual ~TokenServiceProvider(); 149 ~TokenServiceProvider() override;
150 150
151 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 151 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
152 OAuth2TokenService* token_service_; 152 OAuth2TokenService* token_service_;
153 }; 153 };
154 154
155 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service) 155 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service)
156 : task_runner_(base::ThreadTaskRunnerHandle::Get()), 156 : task_runner_(base::ThreadTaskRunnerHandle::Get()),
157 token_service_(token_service) { 157 token_service_(token_service) {
158 DCHECK(token_service_); 158 DCHECK(token_service_);
159 } 159 }
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 hello_world->data() = "hello world"; 638 hello_world->data() = "hello world";
639 EXPECT_EQ("yZRlqg==", 639 EXPECT_EQ("yZRlqg==",
640 AttachmentUploaderImpl::ComputeCrc32cHash( 640 AttachmentUploaderImpl::ComputeCrc32cHash(
641 hello_world->front_as<char>(), hello_world->size())); 641 hello_world->front_as<char>(), hello_world->size()));
642 } 642 }
643 643
644 // TODO(maniscalco): Add test case for when we are uploading an attachment that 644 // TODO(maniscalco): Add test case for when we are uploading an attachment that
645 // already exists. 409 Conflict? (bug 379825) 645 // already exists. 409 Conflict? (bug 379825)
646 646
647 } // namespace syncer 647 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/attachments/attachment_uploader_impl.cc ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698