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

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

Issue 2283153002: Cherrypick Bugfix for cross-origin check (Closed)
Patch Set: Created 4 years, 3 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_data_source.cc ('k') | no next file » | 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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 EXPECT_CALL(*this, ReadCallback(0)); 1418 EXPECT_CALL(*this, ReadCallback(0));
1419 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); 1419 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
1420 FinishLoading(); 1420 FinishLoading();
1421 1421
1422 // Done loading, now we should know the length. 1422 // Done loading, now we should know the length.
1423 EXPECT_TRUE(data_source_->GetSize(&len)); 1423 EXPECT_TRUE(data_source_->GetSize(&len));
1424 EXPECT_EQ(kDataSize, len); 1424 EXPECT_EQ(kDataSize, len);
1425 Stop(); 1425 Stop();
1426 } 1426 }
1427 1427
1428 TEST_F(MultibufferDataSourceTest, DidPassCORSAccessTest) {
1429 InitializeWithCORS(kHttpUrl, true, UrlData::CORS_ANONYMOUS);
1430 set_preload(MultibufferDataSource::NONE);
1431 WebURLResponse response1 =
1432 response_generator_->GeneratePartial206(0, kDataSize - 1);
1433 response1.setWasFetchedViaServiceWorker(true);
1434 response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl));
1435 WebURLResponse response2 =
1436 response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
1437
1438 EXPECT_CALL(host_, SetTotalBytes(kFileSize));
1439 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1440 EXPECT_CALL(*this, ReadCallback(kDataSize));
1441
1442 EXPECT_FALSE(data_source_->DidPassCORSAccessCheck());
1443 Respond(response1);
1444 ReceiveData(kDataSize);
1445 ReadAt(0);
1446 EXPECT_TRUE(loading());
1447 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1448
1449 FinishLoading();
1450
1451 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true.
1452 data_source_->Stop();
1453 base::RunLoop().RunUntilIdle();
1454
1455 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1456 }
1457
1428 } // namespace media 1458 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698