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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 : weak_ptr_factory_(this) { | 270 : weak_ptr_factory_(this) { |
271 } | 271 } |
272 | 272 |
273 void AttachmentUploaderImplTest::OnRequestReceived(const HttpRequest& request) { | 273 void AttachmentUploaderImplTest::OnRequestReceived(const HttpRequest& request) { |
274 DCHECK(CalledOnValidThread()); | 274 DCHECK(CalledOnValidThread()); |
275 http_requests_received_.push_back(request); | 275 http_requests_received_.push_back(request); |
276 } | 276 } |
277 | 277 |
278 void AttachmentUploaderImplTest::SetUp() { | 278 void AttachmentUploaderImplTest::SetUp() { |
279 DCHECK(CalledOnValidThread()); | 279 DCHECK(CalledOnValidThread()); |
280 request_handler_.reset(new RequestHandler(message_loop_.message_loop_proxy(), | 280 request_handler_.reset(new RequestHandler(message_loop_.task_runner(), |
281 weak_ptr_factory_.GetWeakPtr())); | 281 weak_ptr_factory_.GetWeakPtr())); |
282 url_request_context_getter_ = | 282 url_request_context_getter_ = |
283 new net::TestURLRequestContextGetter(message_loop_.message_loop_proxy()); | 283 new net::TestURLRequestContextGetter(message_loop_.task_runner()); |
284 | 284 |
285 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); | 285 ASSERT_TRUE(server_.InitializeAndWaitUntilReady()); |
286 server_.RegisterRequestHandler( | 286 server_.RegisterRequestHandler( |
287 base::Bind(&RequestHandler::HandleRequest, | 287 base::Bind(&RequestHandler::HandleRequest, |
288 base::Unretained(request_handler_.get()))); | 288 base::Unretained(request_handler_.get()))); |
289 | 289 |
290 GURL url(base::StringPrintf("http://localhost:%u/", server_.port())); | 290 GURL url(base::StringPrintf("http://localhost:%u/", server_.port())); |
291 | 291 |
292 token_service_.reset(new MockOAuth2TokenService); | 292 token_service_.reset(new MockOAuth2TokenService); |
293 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> | 293 scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider> |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); | 671 scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); |
672 hello_world->data() = "hello world"; | 672 hello_world->data() = "hello world"; |
673 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( | 673 EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash( |
674 ComputeCrc32c(hello_world))); | 674 ComputeCrc32c(hello_world))); |
675 } | 675 } |
676 | 676 |
677 // TODO(maniscalco): Add test case for when we are uploading an attachment that | 677 // TODO(maniscalco): Add test case for when we are uploading an attachment that |
678 // already exists. 409 Conflict? (bug 379825) | 678 // already exists. 409 Conflict? (bug 379825) |
679 | 679 |
680 } // namespace syncer | 680 } // namespace syncer |
OLD | NEW |