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

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

Issue 1754893006: Fix multibuffer crashing bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK -> CHECK Created 4 years, 9 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
« no previous file with comments | « media/blink/multibuffer.cc ('k') | media/blink/multibuffer_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 1242
1243 ReceiveData(1); 1243 ReceiveData(1);
1244 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3)); 1244 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
1245 FinishLoading(); 1245 FinishLoading();
1246 EXPECT_CALL(*this, ReadCallback(0)); 1246 EXPECT_CALL(*this, ReadCallback(0));
1247 1247
1248 ReadAt(kDataSize + 5, kDataSize * 2); 1248 ReadAt(kDataSize + 5, kDataSize * 2);
1249 Stop(); 1249 Stop();
1250 } 1250 }
1251 1251
1252 TEST_F(MultibufferDataSourceTest, Http_RetryThenRedirect) {
1253 InitializeWith206Response();
1254
1255 // Read to advance our position.
1256 EXPECT_CALL(*this, ReadCallback(kDataSize));
1257 ReadAt(0);
1258
1259 // Issue a pending read but trigger an error to force a retry.
1260 EXPECT_CALL(*this, ReadCallback(kDataSize - 10));
1261 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
1262 ReadAt(kDataSize + 10, kDataSize - 10);
1263 base::RunLoop run_loop;
1264 data_provider()->didFail(url_loader(), response_generator_->GenerateError());
1265 data_provider()->RunOnStart(run_loop.QuitClosure());
1266 run_loop.Run();
1267
1268 // Server responds with a redirect.
1269 blink::WebURLRequest request((GURL(kHttpDifferentPathUrl)));
1270 blink::WebURLResponse response((GURL(kHttpUrl)));
1271 response.setHTTPStatusCode(307);
1272 data_provider()->willFollowRedirect(url_loader(), request, response);
1273 Respond(response_generator_->Generate206(kDataSize));
1274 ReceiveData(kDataSize);
1275 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 3));
1276 FinishLoading();
1277 EXPECT_FALSE(loading());
1278 Stop();
1279 }
1280
1252 } // namespace media 1281 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer.cc ('k') | media/blink/multibuffer_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698