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

Side by Side Diff: sync/internal_api/attachments/attachment_downloader_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, 2 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 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_downloader_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_downloader_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 16 matching lines...) Expand all
27 const char kAttachmentServerUrl[] = "http://attachments.com/"; 27 const char kAttachmentServerUrl[] = "http://attachments.com/";
28 const char kAttachmentContent[] = "attachment.content"; 28 const char kAttachmentContent[] = "attachment.content";
29 29
30 // MockOAuth2TokenService remembers last request for access token and verifies 30 // MockOAuth2TokenService remembers last request for access token and verifies
31 // that only one request is active at a time. 31 // that only one request is active at a time.
32 // Call RespondToAccessTokenRequest to respond to it. 32 // Call RespondToAccessTokenRequest to respond to it.
33 class MockOAuth2TokenService : public FakeOAuth2TokenService { 33 class MockOAuth2TokenService : public FakeOAuth2TokenService {
34 public: 34 public:
35 MockOAuth2TokenService() : num_invalidate_token_(0) {} 35 MockOAuth2TokenService() : num_invalidate_token_(0) {}
36 36
37 virtual ~MockOAuth2TokenService() {} 37 ~MockOAuth2TokenService() override {}
38 38
39 void RespondToAccessTokenRequest(GoogleServiceAuthError error); 39 void RespondToAccessTokenRequest(GoogleServiceAuthError error);
40 40
41 int num_invalidate_token() const { return num_invalidate_token_; } 41 int num_invalidate_token() const { return num_invalidate_token_; }
42 42
43 protected: 43 protected:
44 virtual void FetchOAuth2Token(RequestImpl* request, 44 void FetchOAuth2Token(RequestImpl* request,
45 const std::string& account_id, 45 const std::string& account_id,
46 net::URLRequestContextGetter* getter, 46 net::URLRequestContextGetter* getter,
47 const std::string& client_id, 47 const std::string& client_id,
48 const std::string& client_secret, 48 const std::string& client_secret,
49 const ScopeSet& scopes) override; 49 const ScopeSet& scopes) override;
50 50
51 virtual void InvalidateOAuth2Token(const std::string& account_id, 51 void InvalidateOAuth2Token(const std::string& account_id,
52 const std::string& client_id, 52 const std::string& client_id,
53 const ScopeSet& scopes, 53 const ScopeSet& scopes,
54 const std::string& access_token) override; 54 const std::string& access_token) override;
55 55
56 private: 56 private:
57 base::WeakPtr<RequestImpl> last_request_; 57 base::WeakPtr<RequestImpl> last_request_;
58 int num_invalidate_token_; 58 int num_invalidate_token_;
59 }; 59 };
60 60
61 void MockOAuth2TokenService::RespondToAccessTokenRequest( 61 void MockOAuth2TokenService::RespondToAccessTokenRequest(
62 GoogleServiceAuthError error) { 62 GoogleServiceAuthError error) {
63 EXPECT_TRUE(last_request_ != NULL); 63 EXPECT_TRUE(last_request_ != NULL);
64 std::string access_token; 64 std::string access_token;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ++num_invalidate_token_; 96 ++num_invalidate_token_;
97 } 97 }
98 98
99 class TokenServiceProvider 99 class TokenServiceProvider
100 : public OAuth2TokenServiceRequest::TokenServiceProvider, 100 : public OAuth2TokenServiceRequest::TokenServiceProvider,
101 base::NonThreadSafe { 101 base::NonThreadSafe {
102 public: 102 public:
103 TokenServiceProvider(OAuth2TokenService* token_service); 103 TokenServiceProvider(OAuth2TokenService* token_service);
104 104
105 // OAuth2TokenService::TokenServiceProvider implementation. 105 // OAuth2TokenService::TokenServiceProvider implementation.
106 virtual scoped_refptr<base::SingleThreadTaskRunner> 106 scoped_refptr<base::SingleThreadTaskRunner> GetTokenServiceTaskRunner()
107 GetTokenServiceTaskRunner() override; 107 override;
108 virtual OAuth2TokenService* GetTokenService() override; 108 OAuth2TokenService* GetTokenService() override;
109 109
110 private: 110 private:
111 virtual ~TokenServiceProvider(); 111 ~TokenServiceProvider() override;
112 112
113 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 113 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
114 OAuth2TokenService* token_service_; 114 OAuth2TokenService* token_service_;
115 }; 115 };
116 116
117 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service) 117 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service)
118 : task_runner_(base::ThreadTaskRunnerHandle::Get()), 118 : task_runner_(base::ThreadTaskRunnerHandle::Get()),
119 token_service_(token_service) { 119 token_service_(token_service) {
120 DCHECK(token_service_); 120 DCHECK(token_service_);
121 } 121 }
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 raw += "X-Goog-Hash: md5=rL0Y20zC+Fzt72VPzMSk2A==\n"; 463 raw += "X-Goog-Hash: md5=rL0Y20zC+Fzt72VPzMSk2A==\n";
464 raw += "\n"; 464 raw += "\n";
465 std::replace(raw.begin(), raw.end(), '\n', '\0'); 465 std::replace(raw.begin(), raw.end(), '\n', '\0');
466 scoped_refptr<net::HttpResponseHeaders> headers( 466 scoped_refptr<net::HttpResponseHeaders> headers(
467 new net::HttpResponseHeaders(raw)); 467 new net::HttpResponseHeaders(raw));
468 std::string extracted; 468 std::string extracted;
469 ASSERT_FALSE(AttachmentDownloaderImpl::ExtractCrc32c(*headers, &extracted)); 469 ASSERT_FALSE(AttachmentDownloaderImpl::ExtractCrc32c(*headers, &extracted));
470 } 470 }
471 471
472 } // namespace syncer 472 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/internal_api/attachments/attachment_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698