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

Side by Side Diff: media/blink/buffered_data_source_unittest.cc

Issue 2105713002: Render process changes for ResourceTiming sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resource_timing_sizes_browser_process
Patch Set: Initialise encoded_body_length for sync XHR to data: URLs Created 4 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 void Respond(const WebURLResponse& response) { 208 void Respond(const WebURLResponse& response) {
209 loader()->didReceiveResponse(url_loader(), response); 209 loader()->didReceiveResponse(url_loader(), response);
210 base::RunLoop().RunUntilIdle(); 210 base::RunLoop().RunUntilIdle();
211 } 211 }
212 212
213 void ReceiveData(int size) { 213 void ReceiveData(int size) {
214 std::unique_ptr<char[]> data(new char[size]); 214 std::unique_ptr<char[]> data(new char[size]);
215 memset(data.get(), 0xA5, size); // Arbitrary non-zero value. 215 memset(data.get(), 0xA5, size); // Arbitrary non-zero value.
216 216
217 loader()->didReceiveData(url_loader(), data.get(), size, size); 217 loader()->didReceiveData(url_loader(), data.get(), size, size, size);
218 base::RunLoop().RunUntilIdle(); 218 base::RunLoop().RunUntilIdle();
219 bytes_received_ += size; 219 bytes_received_ += size;
220 EXPECT_EQ(bytes_received_, data_source_->GetMemoryUsage()); 220 EXPECT_EQ(bytes_received_, data_source_->GetMemoryUsage());
221 } 221 }
222 222
223 void FinishLoading() { 223 void FinishLoading() {
224 data_source_->set_loading(false); 224 data_source_->set_loading(false);
225 loader()->didFinishLoading(url_loader(), 0, -1); 225 loader()->didFinishLoading(url_loader(), 0, -1);
226 base::RunLoop().RunUntilIdle(); 226 base::RunLoop().RunUntilIdle();
227 } 227 }
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 while (active_loader() && !active_loader()->deferred()) { 1106 while (active_loader() && !active_loader()->deferred()) {
1107 ReceiveData(kDataSize); 1107 ReceiveData(kDataSize);
1108 bytes_received += kDataSize; 1108 bytes_received += kDataSize;
1109 } 1109 }
1110 EXPECT_GT(bytes_received, 0); 1110 EXPECT_GT(bytes_received, 0);
1111 EXPECT_LT(bytes_received + kDataSize, kFileSize); 1111 EXPECT_LT(bytes_received + kDataSize, kFileSize);
1112 EXPECT_FALSE(active_loader()); 1112 EXPECT_FALSE(active_loader());
1113 } 1113 }
1114 1114
1115 } // namespace media 1115 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698