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

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

Issue 2566943002: Dispatch transfer size update notification on mojo-loading (Closed)
Patch Set: fix 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::OnTransferSizeUpdated(int32_t transfer_size_diff) {
49 EXPECT_GT(transfer_size_diff, 0);
50 body_transfer_size_ += transfer_size_diff;
51 }
52
48 void TestURLLoaderClient::OnStartLoadingResponseBody( 53 void TestURLLoaderClient::OnStartLoadingResponseBody(
49 mojo::ScopedDataPipeConsumerHandle body) { 54 mojo::ScopedDataPipeConsumerHandle body) {
50 response_body_ = std::move(body); 55 response_body_ = std::move(body);
51 if (quit_closure_for_on_start_loading_response_body_) 56 if (quit_closure_for_on_start_loading_response_body_)
52 quit_closure_for_on_start_loading_response_body_.Run(); 57 quit_closure_for_on_start_loading_response_body_.Run();
53 } 58 }
54 59
55 void TestURLLoaderClient::OnComplete( 60 void TestURLLoaderClient::OnComplete(
56 const ResourceRequestCompletionStatus& status) { 61 const ResourceRequestCompletionStatus& status) {
57 has_received_completion_ = true; 62 has_received_completion_ = true;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void TestURLLoaderClient::RunUntilComplete() { 115 void TestURLLoaderClient::RunUntilComplete() {
111 if (has_received_completion_) 116 if (has_received_completion_)
112 return; 117 return;
113 base::RunLoop run_loop; 118 base::RunLoop run_loop;
114 quit_closure_for_on_complete_ = run_loop.QuitClosure(); 119 quit_closure_for_on_complete_ = run_loop.QuitClosure();
115 run_loop.Run(); 120 run_loop.Run();
116 quit_closure_for_on_complete_.Reset(); 121 quit_closure_for_on_complete_.Reset();
117 } 122 }
118 123
119 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/test_url_loader_client.h ('k') | content/browser/loader/url_loader_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698