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

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

Issue 2574143003: Implement upload progress handling in Mojo loading (Closed)
Patch Set: update TestExpectations Created 3 years, 11 months 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::OnTransferSizeUpdated(int32_t transfer_size_diff) { 48 void TestURLLoaderClient::OnTransferSizeUpdated(int32_t transfer_size_diff) {
49 EXPECT_GT(transfer_size_diff, 0); 49 EXPECT_GT(transfer_size_diff, 0);
50 body_transfer_size_ += transfer_size_diff; 50 body_transfer_size_ += transfer_size_diff;
51 } 51 }
52 52
53 void TestURLLoaderClient::OnUploadProgress(int64_t current_position,
54 int64_t total_size,
55 const base::Closure& ack_callback) {
56 ack_callback.Run();
mmenke 2017/01/05 16:31:20 No tests using this?
tzik 2017/01/18 12:56:43 Now, it's used!
57 }
58
53 void TestURLLoaderClient::OnStartLoadingResponseBody( 59 void TestURLLoaderClient::OnStartLoadingResponseBody(
54 mojo::ScopedDataPipeConsumerHandle body) { 60 mojo::ScopedDataPipeConsumerHandle body) {
55 response_body_ = std::move(body); 61 response_body_ = std::move(body);
56 if (quit_closure_for_on_start_loading_response_body_) 62 if (quit_closure_for_on_start_loading_response_body_)
57 quit_closure_for_on_start_loading_response_body_.Run(); 63 quit_closure_for_on_start_loading_response_body_.Run();
58 } 64 }
59 65
60 void TestURLLoaderClient::OnComplete( 66 void TestURLLoaderClient::OnComplete(
61 const ResourceRequestCompletionStatus& status) { 67 const ResourceRequestCompletionStatus& status) {
62 has_received_completion_ = true; 68 has_received_completion_ = true;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void TestURLLoaderClient::RunUntilComplete() { 121 void TestURLLoaderClient::RunUntilComplete() {
116 if (has_received_completion_) 122 if (has_received_completion_)
117 return; 123 return;
118 base::RunLoop run_loop; 124 base::RunLoop run_loop;
119 quit_closure_for_on_complete_ = run_loop.QuitClosure(); 125 quit_closure_for_on_complete_ = run_loop.QuitClosure();
120 run_loop.Run(); 126 run_loop.Run();
121 quit_closure_for_on_complete_.Reset(); 127 quit_closure_for_on_complete_.Reset();
122 } 128 }
123 129
124 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698