OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 // This class is here to give the gtest class access to the | 23 // This class is here to give the gtest class access to the |
24 // mojo::ApplicationImpl so that the tests can connect to other applications. | 24 // mojo::ApplicationImpl so that the tests can connect to other applications. |
25 class MojoRendererTestHelper : public mojo::ApplicationDelegate { | 25 class MojoRendererTestHelper : public mojo::ApplicationDelegate { |
26 public: | 26 public: |
27 MojoRendererTestHelper() : application_impl_(NULL) {} | 27 MojoRendererTestHelper() : application_impl_(NULL) {} |
28 virtual ~MojoRendererTestHelper() {} | 28 virtual ~MojoRendererTestHelper() {} |
29 | 29 |
30 // ApplicationDelegate implementation. | 30 // ApplicationDelegate implementation. |
31 virtual void Initialize(mojo::ApplicationImpl* app) OVERRIDE { | 31 virtual void Initialize(mojo::ApplicationImpl* app) override { |
32 application_impl_ = app; | 32 application_impl_ = app; |
33 } | 33 } |
34 | 34 |
35 mojo::ApplicationImpl* application_impl() { return application_impl_; } | 35 mojo::ApplicationImpl* application_impl() { return application_impl_; } |
36 | 36 |
37 private: | 37 private: |
38 mojo::ApplicationImpl* application_impl_; | 38 mojo::ApplicationImpl* application_impl_; |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(MojoRendererTestHelper); | 40 DISALLOW_COPY_AND_ASSIGN(MojoRendererTestHelper); |
41 }; | 41 }; |
42 | 42 |
43 // TODO(tim): Reconcile this with mojo apptest framework when ready. | 43 // TODO(tim): Reconcile this with mojo apptest framework when ready. |
44 MojoRendererTestHelper* g_test_delegate = NULL; | 44 MojoRendererTestHelper* g_test_delegate = NULL; |
45 | 45 |
46 // TODO(tim): Make media::FakeDemuxerStream support audio and use that for the | 46 // TODO(tim): Make media::FakeDemuxerStream support audio and use that for the |
47 // DemuxerStream implementation instead. | 47 // DemuxerStream implementation instead. |
48 class FakeDemuxerStream : public media::DemuxerStreamProvider, | 48 class FakeDemuxerStream : public media::DemuxerStreamProvider, |
49 public media::DemuxerStream { | 49 public media::DemuxerStream { |
50 public: | 50 public: |
51 FakeDemuxerStream() {} | 51 FakeDemuxerStream() {} |
52 virtual ~FakeDemuxerStream() {} | 52 virtual ~FakeDemuxerStream() {} |
53 | 53 |
54 // media::Demuxer implementation. | 54 // media::Demuxer implementation. |
55 virtual media::DemuxerStream* GetStream( | 55 virtual media::DemuxerStream* GetStream( |
56 media::DemuxerStream::Type type) OVERRIDE { | 56 media::DemuxerStream::Type type) override { |
57 DCHECK_EQ(media::DemuxerStream::AUDIO, type); | 57 DCHECK_EQ(media::DemuxerStream::AUDIO, type); |
58 return this; | 58 return this; |
59 } | 59 } |
60 virtual media::DemuxerStreamProvider::Liveness GetLiveness() const OVERRIDE { | 60 virtual media::DemuxerStreamProvider::Liveness GetLiveness() const override { |
61 return media::DemuxerStreamProvider::LIVENESS_UNKNOWN; | 61 return media::DemuxerStreamProvider::LIVENESS_UNKNOWN; |
62 } | 62 } |
63 | 63 |
64 // media::DemuxerStream implementation. | 64 // media::DemuxerStream implementation. |
65 virtual void Read(const ReadCB& read_cb) OVERRIDE {} | 65 virtual void Read(const ReadCB& read_cb) override {} |
66 | 66 |
67 virtual media::AudioDecoderConfig audio_decoder_config() OVERRIDE { | 67 virtual media::AudioDecoderConfig audio_decoder_config() override { |
68 media::AudioDecoderConfig config; | 68 media::AudioDecoderConfig config; |
69 config.Initialize(media::kCodecAAC, | 69 config.Initialize(media::kCodecAAC, |
70 media::kSampleFormatU8, | 70 media::kSampleFormatU8, |
71 media::CHANNEL_LAYOUT_SURROUND, | 71 media::CHANNEL_LAYOUT_SURROUND, |
72 48000, | 72 48000, |
73 NULL, | 73 NULL, |
74 0, | 74 0, |
75 false, | 75 false, |
76 false, | 76 false, |
77 base::TimeDelta(), | 77 base::TimeDelta(), |
78 0); | 78 0); |
79 return config; | 79 return config; |
80 } | 80 } |
81 | 81 |
82 virtual media::VideoDecoderConfig video_decoder_config() OVERRIDE { | 82 virtual media::VideoDecoderConfig video_decoder_config() override { |
83 NOTREACHED(); | 83 NOTREACHED(); |
84 return media::VideoDecoderConfig(); | 84 return media::VideoDecoderConfig(); |
85 } | 85 } |
86 | 86 |
87 virtual media::DemuxerStream::Type type() OVERRIDE { | 87 virtual media::DemuxerStream::Type type() override { |
88 return media::DemuxerStream::AUDIO; | 88 return media::DemuxerStream::AUDIO; |
89 } | 89 } |
90 | 90 |
91 virtual void EnableBitstreamConverter() OVERRIDE {} | 91 virtual void EnableBitstreamConverter() override {} |
92 | 92 |
93 virtual bool SupportsConfigChanges() OVERRIDE { return true; } | 93 virtual bool SupportsConfigChanges() override { return true; } |
94 | 94 |
95 virtual media::VideoRotation video_rotation() OVERRIDE { | 95 virtual media::VideoRotation video_rotation() override { |
96 NOTREACHED(); | 96 NOTREACHED(); |
97 return media::VIDEO_ROTATION_0; | 97 return media::VIDEO_ROTATION_0; |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); | 101 DISALLOW_COPY_AND_ASSIGN(FakeDemuxerStream); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 | 105 |
106 namespace media { | 106 namespace media { |
107 | 107 |
108 class MojoRendererTest : public testing::Test { | 108 class MojoRendererTest : public testing::Test { |
109 public: | 109 public: |
110 MojoRendererTest() : service_provider_(NULL) {} | 110 MojoRendererTest() : service_provider_(NULL) {} |
111 | 111 |
112 virtual void SetUp() OVERRIDE { | 112 virtual void SetUp() override { |
113 demuxer_stream_provider_.reset(new FakeDemuxerStream()); | 113 demuxer_stream_provider_.reset(new FakeDemuxerStream()); |
114 service_provider_ = | 114 service_provider_ = |
115 g_test_delegate->application_impl() | 115 g_test_delegate->application_impl() |
116 ->ConnectToApplication("mojo:media_mojo_renderer_app") | 116 ->ConnectToApplication("mojo:media_mojo_renderer_app") |
117 ->GetServiceProvider(); | 117 ->GetServiceProvider(); |
118 } | 118 } |
119 | 119 |
120 mojo::ServiceProvider* service_provider() { return service_provider_; } | 120 mojo::ServiceProvider* service_provider() { return service_provider_; } |
121 DemuxerStreamProvider* stream_provider() { | 121 DemuxerStreamProvider* stream_provider() { |
122 return demuxer_stream_provider_.get(); | 122 return demuxer_stream_provider_.get(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 int argc = 0; | 176 int argc = 0; |
177 char** argv = NULL; | 177 char** argv = NULL; |
178 testing::InitGoogleTest(&argc, argv); | 178 testing::InitGoogleTest(&argc, argv); |
179 mojo_ignore_result(RUN_ALL_TESTS()); | 179 mojo_ignore_result(RUN_ALL_TESTS()); |
180 } | 180 } |
181 | 181 |
182 g_test_delegate = NULL; | 182 g_test_delegate = NULL; |
183 delegate.reset(); | 183 delegate.reset(); |
184 return MOJO_RESULT_OK; | 184 return MOJO_RESULT_OK; |
185 } | 185 } |
OLD | NEW |