| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const std::string& last_token_invalidated() const { | 65 const std::string& last_token_invalidated() const { |
| 66 return last_token_invalidated_; | 66 return last_token_invalidated_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 protected: | 69 protected: |
| 70 virtual void FetchOAuth2Token(RequestImpl* request, | 70 virtual void FetchOAuth2Token(RequestImpl* request, |
| 71 const std::string& account_id, | 71 const std::string& account_id, |
| 72 net::URLRequestContextGetter* getter, | 72 net::URLRequestContextGetter* getter, |
| 73 const std::string& client_id, | 73 const std::string& client_id, |
| 74 const std::string& client_secret, | 74 const std::string& client_secret, |
| 75 const ScopeSet& scopes) OVERRIDE; | 75 const ScopeSet& scopes) override; |
| 76 | 76 |
| 77 virtual void InvalidateOAuth2Token(const std::string& account_id, | 77 virtual void InvalidateOAuth2Token(const std::string& account_id, |
| 78 const std::string& client_id, | 78 const std::string& client_id, |
| 79 const ScopeSet& scopes, | 79 const ScopeSet& scopes, |
| 80 const std::string& access_token) OVERRIDE; | 80 const std::string& access_token) override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 GoogleServiceAuthError response_error_; | 83 GoogleServiceAuthError response_error_; |
| 84 std::string response_access_token_; | 84 std::string response_access_token_; |
| 85 base::Time response_expiration_; | 85 base::Time response_expiration_; |
| 86 int num_invalidate_token_; | 86 int num_invalidate_token_; |
| 87 std::string last_token_invalidated_; | 87 std::string last_token_invalidated_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 MockOAuth2TokenService::MockOAuth2TokenService() | 90 MockOAuth2TokenService::MockOAuth2TokenService() |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 class TokenServiceProvider | 133 class TokenServiceProvider |
| 134 : public OAuth2TokenServiceRequest::TokenServiceProvider, | 134 : public OAuth2TokenServiceRequest::TokenServiceProvider, |
| 135 base::NonThreadSafe { | 135 base::NonThreadSafe { |
| 136 public: | 136 public: |
| 137 TokenServiceProvider(OAuth2TokenService* token_service); | 137 TokenServiceProvider(OAuth2TokenService* token_service); |
| 138 | 138 |
| 139 // OAuth2TokenService::TokenServiceProvider implementation. | 139 // OAuth2TokenService::TokenServiceProvider implementation. |
| 140 virtual scoped_refptr<base::SingleThreadTaskRunner> | 140 virtual scoped_refptr<base::SingleThreadTaskRunner> |
| 141 GetTokenServiceTaskRunner() OVERRIDE; | 141 GetTokenServiceTaskRunner() override; |
| 142 virtual OAuth2TokenService* GetTokenService() OVERRIDE; | 142 virtual OAuth2TokenService* GetTokenService() override; |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 virtual ~TokenServiceProvider(); | 145 virtual ~TokenServiceProvider(); |
| 146 | 146 |
| 147 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 147 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 148 OAuth2TokenService* token_service_; | 148 OAuth2TokenService* token_service_; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service) | 151 TokenServiceProvider::TokenServiceProvider(OAuth2TokenService* token_service) |
| 152 : task_runner_(base::ThreadTaskRunnerHandle::Get()), | 152 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 testing::Contains(testing::Pair(header_name, header_value))); | 626 testing::Contains(testing::Pair(header_name, header_value))); |
| 627 | 627 |
| 628 // See that we invalidated the token. | 628 // See that we invalidated the token. |
| 629 ASSERT_EQ(1, token_service().num_invalidate_token()); | 629 ASSERT_EQ(1, token_service().num_invalidate_token()); |
| 630 } | 630 } |
| 631 | 631 |
| 632 // TODO(maniscalco): Add test case for when we are uploading an attachment that | 632 // TODO(maniscalco): Add test case for when we are uploading an attachment that |
| 633 // already exists. 409 Conflict? (bug 379825) | 633 // already exists. 409 Conflict? (bug 379825) |
| 634 | 634 |
| 635 } // namespace syncer | 635 } // namespace syncer |
| OLD | NEW |