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

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

Issue 495353003: Move WebMediaPlayerImpl and its dependencies to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "content/public/common/url_constants.h"
8 #include "content/renderer/media/buffered_data_source.h"
9 #include "content/renderer/media/test_response_generator.h"
10 #include "content/test/mock_webframeclient.h"
11 #include "content/test/mock_weburlloader.h"
12 #include "media/base/media_log.h" 7 #include "media/base/media_log.h"
13 #include "media/base/mock_filters.h" 8 #include "media/base/mock_filters.h"
14 #include "media/base/test_helpers.h" 9 #include "media/base/test_helpers.h"
10 #include "media/blink/buffered_data_source.h"
11 #include "media/blink/mock_webframeclient.h"
12 #include "media/blink/mock_weburlloader.h"
13 #include "media/blink/test_response_generator.h"
15 #include "third_party/WebKit/public/platform/WebURLResponse.h" 14 #include "third_party/WebKit/public/platform/WebURLResponse.h"
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" 15 #include "third_party/WebKit/public/web/WebLocalFrame.h"
17 #include "third_party/WebKit/public/web/WebView.h" 16 #include "third_party/WebKit/public/web/WebView.h"
18 17
19 using ::testing::_; 18 using ::testing::_;
20 using ::testing::Assign; 19 using ::testing::Assign;
21 using ::testing::Invoke; 20 using ::testing::Invoke;
22 using ::testing::InSequence; 21 using ::testing::InSequence;
23 using ::testing::NiceMock; 22 using ::testing::NiceMock;
24 using ::testing::StrictMock; 23 using ::testing::StrictMock;
25 24
26 using blink::WebLocalFrame; 25 using blink::WebLocalFrame;
27 using blink::WebString; 26 using blink::WebString;
28 using blink::WebURLLoader; 27 using blink::WebURLLoader;
29 using blink::WebURLResponse; 28 using blink::WebURLResponse;
30 using blink::WebView; 29 using blink::WebView;
31 30
32 namespace content { 31 namespace media {
33 32
34 class MockBufferedDataSourceHost : public BufferedDataSourceHost { 33 class MockBufferedDataSourceHost : public BufferedDataSourceHost {
35 public: 34 public:
36 MockBufferedDataSourceHost() {} 35 MockBufferedDataSourceHost() {}
37 virtual ~MockBufferedDataSourceHost() {} 36 virtual ~MockBufferedDataSourceHost() {}
38 37
39 MOCK_METHOD1(SetTotalBytes, void(int64 total_bytes)); 38 MOCK_METHOD1(SetTotalBytes, void(int64 total_bytes));
40 MOCK_METHOD2(AddBufferedByteRange, void(int64 start, int64 end)); 39 MOCK_METHOD2(AddBufferedByteRange, void(int64 start, int64 end));
41 40
42 private: 41 private:
43 DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost); 42 DISALLOW_COPY_AND_ASSIGN(MockBufferedDataSourceHost);
44 }; 43 };
45 44
46 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader. 45 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader.
47 // Also keeps track of whether said MockWebURLLoader is actively loading. 46 // Also keeps track of whether said MockWebURLLoader is actively loading.
48 class MockBufferedDataSource : public BufferedDataSource { 47 class MockBufferedDataSource : public BufferedDataSource {
49 public: 48 public:
50 MockBufferedDataSource( 49 MockBufferedDataSource(
51 const GURL& url, 50 const GURL& url,
52 const scoped_refptr<base::MessageLoopProxy>& message_loop, 51 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
53 WebLocalFrame* frame, 52 WebLocalFrame* frame,
54 BufferedDataSourceHost* host) 53 BufferedDataSourceHost* host)
55 : BufferedDataSource(url, 54 : BufferedDataSource(url,
56 BufferedResourceLoader::kUnspecified, 55 BufferedResourceLoader::kUnspecified,
57 message_loop, 56 task_runner,
58 frame, 57 frame,
59 new media::MediaLog(), 58 new media::MediaLog(),
60 host, 59 host,
61 base::Bind(&MockBufferedDataSource::set_downloading, 60 base::Bind(&MockBufferedDataSource::set_downloading,
62 base::Unretained(this))), 61 base::Unretained(this))),
63 downloading_(false), 62 downloading_(false),
64 loading_(false) {} 63 loading_(false) {}
65 virtual ~MockBufferedDataSource() {} 64 virtual ~MockBufferedDataSource() {}
66 65
67 MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64, int64)); 66 MOCK_METHOD2(CreateResourceLoader, BufferedResourceLoader*(int64, int64));
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 769
771 data_source_->MediaIsPlaying(); 770 data_source_->MediaIsPlaying();
772 EXPECT_EQ(BufferedResourceLoader::kCapacityDefer, defer_strategy()); 771 EXPECT_EQ(BufferedResourceLoader::kCapacityDefer, defer_strategy());
773 set_might_be_reused_from_cache_in_future(false); 772 set_might_be_reused_from_cache_in_future(false);
774 data_source_->MediaIsPaused(); 773 data_source_->MediaIsPaused();
775 EXPECT_EQ(BufferedResourceLoader::kCapacityDefer, defer_strategy()); 774 EXPECT_EQ(BufferedResourceLoader::kCapacityDefer, defer_strategy());
776 775
777 Stop(); 776 Stop();
778 } 777 }
779 778
780 } // namespace content 779 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/buffered_data_source_host_impl_unittest.cc ('k') | media/blink/buffered_resource_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698