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

Side by Side Diff: content/browser/loader/test_url_loader_client.cc

Issue 2574143003: Implement upload progress handling in Mojo loading (Closed)
Patch Set: rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/loader/test_url_loader_client.h" 5 #include "content/browser/loader/test_url_loader_client.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 void TestURLLoaderClient::OnDataDownloaded(int64_t data_length, 39 void TestURLLoaderClient::OnDataDownloaded(int64_t data_length,
40 int64_t encoded_data_length) { 40 int64_t encoded_data_length) {
41 has_data_downloaded_ = true; 41 has_data_downloaded_ = true;
42 download_data_length_ += data_length; 42 download_data_length_ += data_length;
43 encoded_download_data_length_ += encoded_data_length; 43 encoded_download_data_length_ += encoded_data_length;
44 if (quit_closure_for_on_data_downloaded_) 44 if (quit_closure_for_on_data_downloaded_)
45 quit_closure_for_on_data_downloaded_.Run(); 45 quit_closure_for_on_data_downloaded_.Run();
46 } 46 }
47 47
48 void TestURLLoaderClient::OnUploadProgress(int64_t current_position,
49 int64_t total_size,
50 const base::Closure& ack_callback) {
51 ack_callback.Run();
52 }
53
48 void TestURLLoaderClient::OnStartLoadingResponseBody( 54 void TestURLLoaderClient::OnStartLoadingResponseBody(
49 mojo::ScopedDataPipeConsumerHandle body) { 55 mojo::ScopedDataPipeConsumerHandle body) {
50 response_body_ = std::move(body); 56 response_body_ = std::move(body);
51 if (quit_closure_for_on_start_loading_response_body_) 57 if (quit_closure_for_on_start_loading_response_body_)
52 quit_closure_for_on_start_loading_response_body_.Run(); 58 quit_closure_for_on_start_loading_response_body_.Run();
53 } 59 }
54 60
55 void TestURLLoaderClient::OnComplete( 61 void TestURLLoaderClient::OnComplete(
56 const ResourceRequestCompletionStatus& status) { 62 const ResourceRequestCompletionStatus& status) {
57 has_received_completion_ = true; 63 has_received_completion_ = true;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void TestURLLoaderClient::RunUntilComplete() { 116 void TestURLLoaderClient::RunUntilComplete() {
111 if (has_received_completion_) 117 if (has_received_completion_)
112 return; 118 return;
113 base::RunLoop run_loop; 119 base::RunLoop run_loop;
114 quit_closure_for_on_complete_ = run_loop.QuitClosure(); 120 quit_closure_for_on_complete_ = run_loop.QuitClosure();
115 run_loop.Run(); 121 run_loop.Run();
116 quit_closure_for_on_complete_.Reset(); 122 quit_closure_for_on_complete_.Reset();
117 } 123 }
118 124
119 } // namespace content 125 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698