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

Side by Side Diff: webkit/media/buffered_data_source_unittest.cc

Issue 12388039: Use base::MessageLoopProxy instead of MessageLoop* in webkit/media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/media/buffered_data_source.cc ('k') | webkit/media/webmediaplayer_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "media/base/media_log.h" 7 #include "media/base/media_log.h"
8 #include "media/base/mock_data_source_host.h" 8 #include "media/base/mock_data_source_host.h"
9 #include "media/base/mock_filters.h" 9 #include "media/base/mock_filters.h"
10 #include "media/base/test_helpers.h" 10 #include "media/base/test_helpers.h"
(...skipping 19 matching lines...) Expand all
30 30
31 using webkit_glue::MockWebFrameClient; 31 using webkit_glue::MockWebFrameClient;
32 using webkit_glue::MockWebURLLoader; 32 using webkit_glue::MockWebURLLoader;
33 33
34 namespace webkit_media { 34 namespace webkit_media {
35 35
36 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader. 36 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader.
37 // Also keeps track of whether said MockWebURLLoader is actively loading. 37 // Also keeps track of whether said MockWebURLLoader is actively loading.
38 class MockBufferedDataSource : public BufferedDataSource { 38 class MockBufferedDataSource : public BufferedDataSource {
39 public: 39 public:
40 MockBufferedDataSource(MessageLoop* message_loop, WebFrame* frame) 40 MockBufferedDataSource(
41 const scoped_refptr<base::MessageLoopProxy>& message_loop,
42 WebFrame* frame)
41 : BufferedDataSource(message_loop, frame, new media::MediaLog(), 43 : BufferedDataSource(message_loop, frame, new media::MediaLog(),
42 base::Bind(&MockBufferedDataSource::set_downloading, 44 base::Bind(&MockBufferedDataSource::set_downloading,
43 base::Unretained(this))), 45 base::Unretained(this))),
44 downloading_(false), 46 downloading_(false),
45 loading_(false) { 47 loading_(false) {
46 } 48 }
47 49
48 MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64, int64)); 50 MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64, int64));
49 BufferedResourceLoader* CreateMockResourceLoader(int64 first_byte_position, 51 BufferedResourceLoader* CreateMockResourceLoader(int64 first_byte_position,
50 int64 last_byte_position) { 52 int64 last_byte_position) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 91
90 static const char kHttpUrl[] = "http://localhost/foo.webm"; 92 static const char kHttpUrl[] = "http://localhost/foo.webm";
91 static const char kFileUrl[] = "file:///tmp/bar.webm"; 93 static const char kFileUrl[] = "file:///tmp/bar.webm";
92 94
93 class BufferedDataSourceTest : public testing::Test { 95 class BufferedDataSourceTest : public testing::Test {
94 public: 96 public:
95 BufferedDataSourceTest() 97 BufferedDataSourceTest()
96 : view_(WebView::create(NULL)) { 98 : view_(WebView::create(NULL)) {
97 view_->initializeMainFrame(&client_); 99 view_->initializeMainFrame(&client_);
98 100
99 data_source_ = new MockBufferedDataSource(&message_loop_, 101 data_source_ = new MockBufferedDataSource(
100 view_->mainFrame()); 102 message_loop_.message_loop_proxy(), view_->mainFrame());
101 data_source_->set_host(&host_); 103 data_source_->set_host(&host_);
102 } 104 }
103 105
104 virtual ~BufferedDataSourceTest() { 106 virtual ~BufferedDataSourceTest() {
105 view_->close(); 107 view_->close();
106 } 108 }
107 109
108 MOCK_METHOD1(OnInitialize, void(bool)); 110 MOCK_METHOD1(OnInitialize, void(bool));
109 111
110 void Initialize(const char* url, bool expected) { 112 void Initialize(const char* url, bool expected) {
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 InitializeWithFileResponse(); 649 InitializeWithFileResponse();
648 650
649 EXPECT_FALSE(data_source_->downloading()); 651 EXPECT_FALSE(data_source_->downloading());
650 FinishLoading(); 652 FinishLoading();
651 EXPECT_FALSE(data_source_->downloading()); 653 EXPECT_FALSE(data_source_->downloading());
652 654
653 Stop(); 655 Stop();
654 } 656 }
655 657
656 } // namespace webkit_media 658 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/buffered_data_source.cc ('k') | webkit/media/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698