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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 request_handler_.reset(new RequestHandler(message_loop_.message_loop_proxy(), | 268 request_handler_.reset(new RequestHandler(message_loop_.message_loop_proxy(), |
269 weak_ptr_factory_.GetWeakPtr())); | 269 weak_ptr_factory_.GetWeakPtr())); |
270 url_request_context_getter_ = | 270 url_request_context_getter_ = |
271 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); | 271 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); |
272 | 272 |
273 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); | 273 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); |
274 server_.RegisterRequestHandler( | 274 server_.RegisterRequestHandler( |
275 base::Bind(&RequestHandler::HandleRequest, | 275 base::Bind(&RequestHandler::HandleRequest, |
276 base::Unretained(request_handler_.get()))); | 276 base::Unretained(request_handler_.get()))); |
277 | 277 |
278 GURL url(base::StringPrintf("http://localhost:%d/", server_.port())); | 278 GURL url(base::StringPrintf("http://localhost:%u/", server_.port())); |
Peter Kasting
2014/11/12 23:53:55
I don't think the distinction here actually matter
cpu_(ooo_6.6-7.5)
2014/11/14 18:37:06
I imagine printf'ing is not the best practice here
Peter Kasting
2014/11/14 20:36:45
I think we could construct "http://localhost/" and
| |
279 | 279 |
280 token_service_.reset(new MockOAuth2TokenService); | 280 token_service_.reset(new MockOAuth2TokenService); |
281 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 281 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
282 token_service_provider(new TokenServiceProvider(token_service_.get())); | 282 token_service_provider(new TokenServiceProvider(token_service_.get())); |
283 | 283 |
284 OAuth2TokenService::ScopeSet scopes; | 284 OAuth2TokenService::ScopeSet scopes; |
285 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 285 scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
286 uploader().reset(new AttachmentUploaderImpl(url, | 286 uploader().reset(new AttachmentUploaderImpl(url, |
287 url_request_context_getter_, | 287 url_request_context_getter_, |
288 kAccountId, | 288 kAccountId, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
638 hello_world->data() = "hello world"; | 638 hello_world->data() = "hello world"; |
639 EXPECT_EQ("yZRlqg==", | 639 EXPECT_EQ("yZRlqg==", |
640 AttachmentUploaderImpl::ComputeCrc32cHash( | 640 AttachmentUploaderImpl::ComputeCrc32cHash( |
641 hello_world->front_as<char>(), hello_world->size())); | 641 hello_world->front_as<char>(), hello_world->size())); |
642 } | 642 } |
643 | 643 |
644 // TODO(maniscalco): Add test case for when we are uploading an attachment that | 644 // TODO(maniscalco): Add test case for when we are uploading an attachment that |
645 // already exists. 409 Conflict? (bug 379825) | 645 // already exists. 409 Conflict? (bug 379825) |
646 | 646 |
647 } // namespace syncer | 647 } // namespace syncer |
OLD | NEW |