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

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

Issue 2271313002: Bugfix for cross-origin check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test added 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 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2)); 1441 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize * 2));
1442 ReceiveData(kDataSize / 2); 1442 ReceiveData(kDataSize / 2);
1443 FinishLoading(); 1443 FinishLoading();
1444 1444
1445 int64_t len = 0; 1445 int64_t len = 0;
1446 EXPECT_TRUE(data_source_->GetSize(&len)); 1446 EXPECT_TRUE(data_source_->GetSize(&len));
1447 EXPECT_EQ(kDataSize / 2, len); 1447 EXPECT_EQ(kDataSize / 2, len);
1448 Stop(); 1448 Stop();
1449 } 1449 }
1450 1450
1451 TEST_F(MultibufferDataSourceTest, DidPassCORSAccessTest) {
1452 InitializeWithCORS(kHttpUrl, true, UrlData::CORS_ANONYMOUS);
1453 set_preload(MultibufferDataSource::NONE);
1454 WebURLResponse response1 =
1455 response_generator_->GeneratePartial206(0, kDataSize - 1);
1456 response1.setWasFetchedViaServiceWorker(true);
1457 response1.setOriginalURLViaServiceWorker(GURL(kHttpDifferentOriginUrl));
1458 WebURLResponse response2 =
1459 response_generator_->GeneratePartial206(kDataSize, kDataSize * 2 - 1);
1460
1461 EXPECT_CALL(host_, SetTotalBytes(kFileSize));
1462 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1463 EXPECT_CALL(*this, ReadCallback(kDataSize));
1464
1465 EXPECT_FALSE(data_source_->DidPassCORSAccessCheck());
1466 Respond(response1);
1467 ReceiveData(kDataSize);
1468 ReadAt(0);
1469 EXPECT_TRUE(loading());
1470 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1471
1472 FinishLoading();
1473
1474 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true.
1475 data_source_->Stop();
1476 base::RunLoop().RunUntilIdle();
1477
1478 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1479 }
1480
1451 } // namespace media 1481 } // 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