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

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

Issue 2389493002: Revert of Require WebLocalFrame to be created with a non-null client (Closed)
Patch Set: Created 4 years, 2 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"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "media/base/media_log.h" 13 #include "media/base/media_log.h"
14 #include "media/base/mock_filters.h" 14 #include "media/base/mock_filters.h"
15 #include "media/base/test_helpers.h" 15 #include "media/base/test_helpers.h"
16 #include "media/blink/buffered_data_source_host_impl.h" 16 #include "media/blink/buffered_data_source_host_impl.h"
17 #include "media/blink/mock_webframeclient.h"
17 #include "media/blink/mock_weburlloader.h" 18 #include "media/blink/mock_weburlloader.h"
18 #include "media/blink/multibuffer_data_source.h" 19 #include "media/blink/multibuffer_data_source.h"
19 #include "media/blink/multibuffer_reader.h" 20 #include "media/blink/multibuffer_reader.h"
20 #include "media/blink/resource_multibuffer_data_provider.h" 21 #include "media/blink/resource_multibuffer_data_provider.h"
21 #include "media/blink/test_response_generator.h" 22 #include "media/blink/test_response_generator.h"
22 #include "third_party/WebKit/public/platform/WebURLResponse.h" 23 #include "third_party/WebKit/public/platform/WebURLResponse.h"
23 #include "third_party/WebKit/public/web/WebFrameClient.h"
24 #include "third_party/WebKit/public/web/WebLocalFrame.h" 24 #include "third_party/WebKit/public/web/WebLocalFrame.h"
25 #include "third_party/WebKit/public/web/WebView.h" 25 #include "third_party/WebKit/public/web/WebView.h"
26 26
27 using ::testing::_; 27 using ::testing::_;
28 using ::testing::Assign; 28 using ::testing::Assign;
29 using ::testing::DoAll; 29 using ::testing::DoAll;
30 using ::testing::Invoke; 30 using ::testing::Invoke;
31 using ::testing::InvokeWithoutArgs; 31 using ::testing::InvokeWithoutArgs;
32 using ::testing::InSequence; 32 using ::testing::InSequence;
33 using ::testing::NiceMock; 33 using ::testing::NiceMock;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 static const char kHttpUrl[] = "http://localhost/foo.webm"; 219 static const char kHttpUrl[] = "http://localhost/foo.webm";
220 static const char kFileUrl[] = "file:///tmp/bar.webm"; 220 static const char kFileUrl[] = "file:///tmp/bar.webm";
221 static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm"; 221 static const char kHttpDifferentPathUrl[] = "http://localhost/bar.webm";
222 static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm"; 222 static const char kHttpDifferentOriginUrl[] = "http://127.0.0.1/foo.webm";
223 223
224 class MultibufferDataSourceTest : public testing::Test { 224 class MultibufferDataSourceTest : public testing::Test {
225 public: 225 public:
226 MultibufferDataSourceTest() 226 MultibufferDataSourceTest()
227 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)), 227 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)),
228 preload_(MultibufferDataSource::AUTO) { 228 frame_(
229 WebLocalFrame* frame = 229 WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_)),
230 WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_); 230 preload_(MultibufferDataSource::AUTO),
231 view_->setMainFrame(frame); 231 url_index_(make_linked_ptr(new TestUrlIndex(frame_))) {
232 url_index_ = make_linked_ptr(new TestUrlIndex(frame)); 232 view_->setMainFrame(frame_);
233 } 233 }
234 234
235 virtual ~MultibufferDataSourceTest() { 235 virtual ~MultibufferDataSourceTest() {
236 view_->close(); 236 view_->close();
237 frame_->close();
237 } 238 }
238 239
239 MOCK_METHOD1(OnInitialize, void(bool)); 240 MOCK_METHOD1(OnInitialize, void(bool));
240 241
241 void InitializeWithCORS(const char* url, 242 void InitializeWithCORS(const char* url,
242 bool expected, 243 bool expected,
243 UrlData::CORSMode cors_mode) { 244 UrlData::CORSMode cors_mode) {
244 GURL gurl(url); 245 GURL gurl(url);
245 data_source_.reset(new MockMultibufferDataSource( 246 data_source_.reset(new MockMultibufferDataSource(
246 gurl, cors_mode, message_loop_.task_runner(), url_index_, 247 gurl, cors_mode, message_loop_.task_runner(), url_index_,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 469 }
469 int data_source_bitrate() { return data_source_->bitrate_; } 470 int data_source_bitrate() { return data_source_->bitrate_; }
470 double data_source_playback_rate() { return data_source_->playback_rate_; } 471 double data_source_playback_rate() { return data_source_->playback_rate_; }
471 bool is_local_source() { return data_source_->assume_fully_buffered(); } 472 bool is_local_source() { return data_source_->assume_fully_buffered(); }
472 scoped_refptr<UrlData> url_data() { return data_source_->url_data_; } 473 scoped_refptr<UrlData> url_data() { return data_source_->url_data_; }
473 void set_might_be_reused_from_cache_in_future(bool value) { 474 void set_might_be_reused_from_cache_in_future(bool value) {
474 url_data()->set_cacheable(value); 475 url_data()->set_cacheable(value);
475 } 476 }
476 477
477 protected: 478 protected:
478 blink::WebFrameClient client_; 479 MockWebFrameClient client_;
479 WebView* view_; 480 WebView* view_;
481 WebLocalFrame* frame_;
480 MultibufferDataSource::Preload preload_; 482 MultibufferDataSource::Preload preload_;
481 base::MessageLoop message_loop_; 483 base::MessageLoop message_loop_;
482 linked_ptr<TestUrlIndex> url_index_; 484 linked_ptr<TestUrlIndex> url_index_;
483 485
484 std::unique_ptr<MockMultibufferDataSource> data_source_; 486 std::unique_ptr<MockMultibufferDataSource> data_source_;
485 487
486 std::unique_ptr<TestResponseGenerator> response_generator_; 488 std::unique_ptr<TestResponseGenerator> response_generator_;
487 489
488 StrictMock<MockBufferedDataSourceHost> host_; 490 StrictMock<MockBufferedDataSourceHost> host_;
489 491
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 const std::string etag("\"arglebargle glop-glyf?\""); 1521 const std::string etag("\"arglebargle glop-glyf?\"");
1520 response.setHTTPHeaderField(WebString::fromUTF8("Etag"), 1522 response.setHTTPHeaderField(WebString::fromUTF8("Etag"),
1521 WebString::fromUTF8(etag)); 1523 WebString::fromUTF8(etag));
1522 Respond(response); 1524 Respond(response);
1523 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize)); 1525 EXPECT_CALL(host_, AddBufferedByteRange(0, kDataSize));
1524 ReceiveData(kDataSize); 1526 ReceiveData(kDataSize);
1525 1527
1526 EXPECT_EQ(url_data()->etag(), etag); 1528 EXPECT_EQ(url_data()->etag(), etag);
1527 } 1529 }
1528 } // namespace media 1530 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/mock_webframeclient.h ('k') | media/blink/resource_multibuffer_data_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698