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

Unified Diff: sync/internal_api/attachments/attachment_downloader_impl_unittest.cc

Issue 458753006: Fix use after free bug by calling GetTokenService in Core's ctor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update TSP comment (CANDIDATE). Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
diff --git a/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc b/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
index 1b27abdd600724f3dd5efd20513e8337c70b9bd6..01b12c17c974040dedd0df5a073d18f0a802a44f 100644
--- a/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
+++ b/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
@@ -99,7 +99,6 @@ class TokenServiceProvider
base::NonThreadSafe {
public:
TokenServiceProvider(OAuth2TokenService* token_service);
- virtual ~TokenServiceProvider();
// OAuth2TokenService::TokenServiceProvider implementation.
virtual scoped_refptr<base::SingleThreadTaskRunner>
@@ -107,6 +106,8 @@ class TokenServiceProvider
virtual OAuth2TokenService* GetTokenService() OVERRIDE;
private:
+ virtual ~TokenServiceProvider();
+
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
OAuth2TokenService* token_service_;
};
@@ -182,7 +183,7 @@ void AttachmentDownloaderImplTest::SetUp() {
url_fetcher_factory_.set_remove_fetcher_on_delete(true);
token_service_.reset(new MockOAuth2TokenService());
token_service_->AddAccount(kAccountId);
- scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider>
+ scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>
token_service_provider(new TokenServiceProvider(token_service_.get()));
OAuth2TokenService::ScopeSet scopes;
@@ -192,7 +193,7 @@ void AttachmentDownloaderImplTest::SetUp() {
url_request_context_getter_,
kAccountId,
scopes,
- token_service_provider.Pass());
+ token_service_provider);
}
void AttachmentDownloaderImplTest::TearDown() {

Powered by Google App Engine
This is Rietveld 408576698