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

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

Issue 2338963002: Store, use and send etags. (Closed)
Patch Set: comments addressed 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
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 CHECK(loader()); 459 CHECK(loader());
460 return loader()->preload_high(); 460 return loader()->preload_high();
461 } 461 }
462 int64_t preload_low() { 462 int64_t preload_low() {
463 CHECK(loader()); 463 CHECK(loader());
464 return loader()->preload_low(); 464 return loader()->preload_low();
465 } 465 }
466 int data_source_bitrate() { return data_source_->bitrate_; } 466 int data_source_bitrate() { return data_source_->bitrate_; }
467 double data_source_playback_rate() { return data_source_->playback_rate_; } 467 double data_source_playback_rate() { return data_source_->playback_rate_; }
468 bool is_local_source() { return data_source_->assume_fully_buffered(); } 468 bool is_local_source() { return data_source_->assume_fully_buffered(); }
469 scoped_refptr<UrlData> url_data() { return data_source_->url_data_; }
469 void set_might_be_reused_from_cache_in_future(bool value) { 470 void set_might_be_reused_from_cache_in_future(bool value) {
470 data_source_->url_data_->set_cacheable(value); 471 url_data()->set_cacheable(value);
471 } 472 }
472 473
473 protected: 474 protected:
474 MockWebFrameClient client_; 475 MockWebFrameClient client_;
475 WebView* view_; 476 WebView* view_;
476 WebLocalFrame* frame_; 477 WebLocalFrame* frame_;
477 MultibufferDataSource::Preload preload_; 478 MultibufferDataSource::Preload preload_;
478 base::MessageLoop message_loop_; 479 base::MessageLoop message_loop_;
479 linked_ptr<TestUrlIndex> url_index_; 480 linked_ptr<TestUrlIndex> url_index_;
480 481
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 1472
1472 FinishLoading(); 1473 FinishLoading();
1473 1474
1474 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true. 1475 // Verify that if reader_ is null, DidPassCORSAccessCheck still returns true.
1475 data_source_->Stop(); 1476 data_source_->Stop();
1476 base::RunLoop().RunUntilIdle(); 1477 base::RunLoop().RunUntilIdle();
1477 1478
1478 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck()); 1479 EXPECT_TRUE(data_source_->DidPassCORSAccessCheck());
1479 } 1480 }
1480 1481
1482 TEST_F(MultibufferDataSourceTest, EtagTest) {
1483 Initialize(kHttpUrl, true);
1484
1485 EXPECT_CALL(host_, SetTotalBytes(response_generator_->content_length()));
1486 WebURLResponse response = response_generator_->Generate206(0);
1487 const std::string etag("\"arglebargle glop-glyf?\"");
1488 response.setHTTPHeaderField(WebString::fromUTF8("Etag"),
1489 WebString::fromUTF8(etag));
1490 Respond(response);
1491 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1492 ReceiveData(kDataSize);
1493
1494 EXPECT_EQ(url_data()->etag(), etag);
1495 }
1481 } // namespace media 1496 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/resource_multibuffer_data_provider.cc » ('j') | media/blink/url_index.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698