| 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_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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 net::TestURLFetcherFactory url_fetcher_factory_; | 198 net::TestURLFetcherFactory url_fetcher_factory_; |
| 199 scoped_ptr<MockOAuth2TokenService> token_service_; | 199 scoped_ptr<MockOAuth2TokenService> token_service_; |
| 200 scoped_ptr<AttachmentDownloader> attachment_downloader_; | 200 scoped_ptr<AttachmentDownloader> attachment_downloader_; |
| 201 ResultsMap download_results_; | 201 ResultsMap download_results_; |
| 202 int num_completed_downloads_; | 202 int num_completed_downloads_; |
| 203 const AttachmentId attachment_id_; | 203 const AttachmentId attachment_id_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 void AttachmentDownloaderImplTest::SetUp() { | 206 void AttachmentDownloaderImplTest::SetUp() { |
| 207 url_request_context_getter_ = | 207 url_request_context_getter_ = |
| 208 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); | 208 new net::TestURLRequestContextGetter(message_loop_.task_runner()); |
| 209 url_fetcher_factory_.set_remove_fetcher_on_delete(true); | 209 url_fetcher_factory_.set_remove_fetcher_on_delete(true); |
| 210 token_service_.reset(new MockOAuth2TokenService()); | 210 token_service_.reset(new MockOAuth2TokenService()); |
| 211 token_service_->AddAccount(kAccountId); | 211 token_service_->AddAccount(kAccountId); |
| 212 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 212 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
| 213 token_service_provider(new TokenServiceProvider(token_service_.get())); | 213 token_service_provider(new TokenServiceProvider(token_service_.get())); |
| 214 | 214 |
| 215 OAuth2TokenService::ScopeSet scopes; | 215 OAuth2TokenService::ScopeSet scopes; |
| 216 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 216 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
| 217 attachment_downloader_ = AttachmentDownloader::Create( | 217 attachment_downloader_ = AttachmentDownloader::Create( |
| 218 GURL(kAttachmentServerUrl), url_request_context_getter_, kAccountId, | 218 GURL(kAttachmentServerUrl), url_request_context_getter_, kAccountId, |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 raw += "\n"; | 528 raw += "\n"; |
| 529 std::replace(raw.begin(), raw.end(), '\n', '\0'); | 529 std::replace(raw.begin(), raw.end(), '\n', '\0'); |
| 530 scoped_refptr<net::HttpResponseHeaders> headers( | 530 scoped_refptr<net::HttpResponseHeaders> headers( |
| 531 new net::HttpResponseHeaders(raw)); | 531 new net::HttpResponseHeaders(raw)); |
| 532 uint32_t extracted; | 532 uint32_t extracted; |
| 533 ASSERT_FALSE( | 533 ASSERT_FALSE( |
| 534 AttachmentDownloaderImpl::ExtractCrc32c(headers.get(), &extracted)); | 534 AttachmentDownloaderImpl::ExtractCrc32c(headers.get(), &extracted)); |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace syncer | 537 } // namespace syncer |
| OLD | NEW |