Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(980)

Side by Side Diff: content/browser/fileapi/mock_url_request_delegate.cc

Issue 1410643007: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move NotifyReadCompleted Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/fileapi/mock_url_request_delegate.h" 5 #include "content/browser/fileapi/mock_url_request_delegate.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/thread_task_runner_handle.h"
8 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace { 12 namespace {
12 const int kBufferSize = 1024; 13 const int kBufferSize = 1024;
13 } 14 }
14 15
15 namespace content { 16 namespace content {
16 17
17 MockURLRequestDelegate::MockURLRequestDelegate() 18 MockURLRequestDelegate::MockURLRequestDelegate()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (bytes_read) { 60 if (bytes_read) {
60 response_data_.append(io_buffer_->data(), 61 response_data_.append(io_buffer_->data(),
61 static_cast<size_t>(bytes_read)); 62 static_cast<size_t>(bytes_read));
62 ReadSome(request); 63 ReadSome(request);
63 } else { 64 } else {
64 RequestComplete(); 65 RequestComplete();
65 } 66 }
66 } 67 }
67 68
68 void MockURLRequestDelegate::RequestComplete() { 69 void MockURLRequestDelegate::RequestComplete() {
69 base::MessageLoop::current()->QuitWhenIdle(); 70 base::ThreadTaskRunnerHandle::Get()->PostTask(
71 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
mmenke 2015/10/28 16:40:42 Why is this change part of this CL?
xunjieli 2015/10/28 21:11:52 Done.
70 } 72 }
71 73
72 } // namespace 74 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698