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/api/attachments/attachment_downloader.h" | 5 #include "sync/api/attachments/attachment_downloader.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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); | 180 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); |
181 url_fetcher_factory_.set_remove_fetcher_on_delete(true); | 181 url_fetcher_factory_.set_remove_fetcher_on_delete(true); |
182 token_service_.reset(new MockOAuth2TokenService()); | 182 token_service_.reset(new MockOAuth2TokenService()); |
183 token_service_->AddAccount(kAccountId); | 183 token_service_->AddAccount(kAccountId); |
184 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 184 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
185 token_service_provider(new TokenServiceProvider(token_service_.get())); | 185 token_service_provider(new TokenServiceProvider(token_service_.get())); |
186 | 186 |
187 OAuth2TokenService::ScopeSet scopes; | 187 OAuth2TokenService::ScopeSet scopes; |
188 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 188 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
189 attachment_downloader_ = | 189 attachment_downloader_ = |
190 AttachmentDownloader::Create(GURL(kAttachmentServerUrl), | 190 AttachmentDownloader::Create(kAttachmentServerUrl, |
191 url_request_context_getter_, | 191 url_request_context_getter_, |
192 kAccountId, | 192 kAccountId, |
193 scopes, | 193 scopes, |
194 token_service_provider.Pass()); | 194 token_service_provider.Pass()); |
195 } | 195 } |
196 | 196 |
197 void AttachmentDownloaderImplTest::TearDown() { | 197 void AttachmentDownloaderImplTest::TearDown() { |
198 RunMessageLoop(); | 198 RunMessageLoop(); |
199 } | 199 } |
200 | 200 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 GoogleServiceAuthError::AuthErrorNone()); | 347 GoogleServiceAuthError::AuthErrorNone()); |
348 RunMessageLoop(); | 348 RunMessageLoop(); |
349 // Fail URLFetcher. This should trigger download failure. Access token | 349 // Fail URLFetcher. This should trigger download failure. Access token |
350 // shouldn't be invalidated. | 350 // shouldn't be invalidated. |
351 CompleteDownload(net::HTTP_SERVICE_UNAVAILABLE); | 351 CompleteDownload(net::HTTP_SERVICE_UNAVAILABLE); |
352 EXPECT_EQ(0, token_service()->num_invalidate_token()); | 352 EXPECT_EQ(0, token_service()->num_invalidate_token()); |
353 VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_UNSPECIFIED_ERROR); | 353 VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_UNSPECIFIED_ERROR); |
354 } | 354 } |
355 | 355 |
356 } // namespace syncer | 356 } // namespace syncer |
OLD | NEW |