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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 scoped_ptr<HttpResponse> RequestHandler::HandleRequest( | 378 scoped_ptr<HttpResponse> RequestHandler::HandleRequest( |
379 const HttpRequest& request) { | 379 const HttpRequest& request) { |
380 DCHECK(CalledOnValidThread()); | 380 DCHECK(CalledOnValidThread()); |
381 test_task_runner_->PostTask( | 381 test_task_runner_->PostTask( |
382 FROM_HERE, | 382 FROM_HERE, |
383 base::Bind( | 383 base::Bind( |
384 &AttachmentUploaderImplTest::OnRequestReceived, test_, request)); | 384 &AttachmentUploaderImplTest::OnRequestReceived, test_, request)); |
385 scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse); | 385 scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse); |
386 response->set_code(GetStatusCode()); | 386 response->set_code(GetStatusCode()); |
387 response->set_content_type("text/plain"); | 387 response->set_content_type("text/plain"); |
388 return response.PassAs<HttpResponse>(); | 388 return response.Pass(); |
389 } | 389 } |
390 | 390 |
391 void RequestHandler::SetStatusCode(const net::HttpStatusCode& status_code) { | 391 void RequestHandler::SetStatusCode(const net::HttpStatusCode& status_code) { |
392 base::AutoLock lock(mutex_); | 392 base::AutoLock lock(mutex_); |
393 status_code_ = status_code; | 393 status_code_ = status_code; |
394 } | 394 } |
395 | 395 |
396 net::HttpStatusCode RequestHandler::GetStatusCode() const { | 396 net::HttpStatusCode RequestHandler::GetStatusCode() const { |
397 base::AutoLock lock(mutex_); | 397 base::AutoLock lock(mutex_); |
398 return status_code_; | 398 return status_code_; |
(...skipping 239 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 |