| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 request_handler_.reset(new RequestHandler(message_loop_.message_loop_proxy(), | 275 request_handler_.reset(new RequestHandler(message_loop_.message_loop_proxy(), |
| 276 weak_ptr_factory_.GetWeakPtr())); | 276 weak_ptr_factory_.GetWeakPtr())); |
| 277 url_request_context_getter_ = | 277 url_request_context_getter_ = |
| 278 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); | 278 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); |
| 279 | 279 |
| 280 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); | 280 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); |
| 281 server_.RegisterRequestHandler( | 281 server_.RegisterRequestHandler( |
| 282 base::Bind(&RequestHandler::HandleRequest, | 282 base::Bind(&RequestHandler::HandleRequest, |
| 283 base::Unretained(request_handler_.get()))); | 283 base::Unretained(request_handler_.get()))); |
| 284 | 284 |
| 285 GURL url(base::StringPrintf("http://localhost:%d/", server_.port())); | 285 GURL url(base::StringPrintf("http://localhost:%u/", server_.port())); |
| 286 | 286 |
| 287 token_service_.reset(new MockOAuth2TokenService); | 287 token_service_.reset(new MockOAuth2TokenService); |
| 288 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 288 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
| 289 token_service_provider(new TokenServiceProvider(token_service_.get())); | 289 token_service_provider(new TokenServiceProvider(token_service_.get())); |
| 290 | 290 |
| 291 OAuth2TokenService::ScopeSet scopes; | 291 OAuth2TokenService::ScopeSet scopes; |
| 292 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 292 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
| 293 uploader().reset(new AttachmentUploaderImpl( | 293 uploader().reset(new AttachmentUploaderImpl( |
| 294 url, url_request_context_getter_, kAccountId, scopes, | 294 url, url_request_context_getter_, kAccountId, scopes, |
| 295 token_service_provider, std::string(kStoreBirthday))); | 295 token_service_provider, std::string(kStoreBirthday))); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); | 647 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); |
| 648 hello_world->data() = "hello world"; | 648 hello_world->data() = "hello world"; |
| 649 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( | 649 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( |
| 650 ComputeCrc32c(hello_world))); | 650 ComputeCrc32c(hello_world))); |
| 651 } | 651 } |
| 652 | 652 |
| 653 // TODO(maniscalco): Add test case for when we are uploading an attachment that | 653 // TODO(maniscalco): Add test case for when we are uploading an attachment that |
| 654 // already exists. 409 Conflict? (bug 379825) | 654 // already exists. 409 Conflict? (bug 379825) |
| 655 | 655 |
| 656 } // namespace syncer | 656 } // namespace syncer |
| OLD | NEW |