Merge lp:~rsalveti/media-hub/migrating-tests-open-formats into lp:media-hub

Proposed by Ricardo Salveti on 2015-03-03
Status: Merged
Approved by: Jim Hodapp on 2015-03-04
Approved revision: 110
Merged at revision: 110
Proposed branch: lp:~rsalveti/media-hub/migrating-tests-open-formats
Merge into: lp:media-hub
Diff against target: 321 lines (+44/-83)
5 files modified
debian/control (+0/-2)
tests/acceptance-tests/service.cpp (+13/-13)
tests/test_data.cpp.in (+3/-38)
tests/test_data.h (+1/-3)
tests/unit-tests/test-gstreamer-engine.cpp (+27/-27)
To merge this branch: bzr merge lp:~rsalveti/media-hub/migrating-tests-open-formats
Reviewer Review Type Date Requested Status
Jim Hodapp 2015-03-04 Approve on 2015-03-04
PS Jenkins bot continuous-integration Approve on 2015-03-03
Ubuntu Phablet Team 2015-03-03 Pending
Review via email: mp+251669@code.launchpad.net

Commit Message

Migrating tests to use ogg instead of mp3/avi

Description of the Change

Migrating tests to use ogg instead of mp3/avi

To post a comment you must log in.
Jim Hodapp (jhodapp) wrote :

Looks good, thanks man.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-11-18 20:29:26 +0000
3+++ debian/control 2015-03-03 22:54:52 +0000
4@@ -10,7 +10,6 @@
5 google-mock,
6 graphviz,
7 gstreamer1.0-plugins-good,
8- gstreamer1.0-fluendo-mp3,
9 # We rely on C++11 features, and to prevent from ABI breaks
10 # in libstdc++ causing us issues, we explicitly select a G++
11 # version.
12@@ -25,7 +24,6 @@
13 libhybris-dev (>=0.1.0+git20131207+e452e83-0ubuntu30),
14 libprocess-cpp-dev,
15 libproperties-cpp-dev,
16- gstreamer1.0-libav,
17 libgstreamer1.0-dev,
18 pkg-config,
19 libpulse-dev,
20
21=== modified file 'tests/acceptance-tests/service.cpp'
22--- tests/acceptance-tests/service.cpp 2014-10-01 03:47:47 +0000
23+++ tests/acceptance-tests/service.cpp 2015-03-03 22:54:52 +0000
24@@ -187,10 +187,10 @@
25
26 TEST(MusicService, DISABLED_remotely_querying_track_meta_data_works)
27 {
28- const std::string test_file{"/tmp/test.ogg"};
29- const std::string test_file_uri{"file:///tmp/test.ogg"};
30+ const std::string test_file{"/tmp/test-audio.ogg"};
31+ const std::string test_file_uri{"file:///tmp/test-audio.ogg"};
32 std::remove(test_file.c_str());
33- ASSERT_TRUE(test::copy_test_ogg_file_to(test_file));
34+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio.ogg", test_file));
35
36 core::testing::CrossProcessSync sync_service_start;
37
38@@ -215,7 +215,7 @@
39 {
40 sync_service_start.wait_for_signal_ready_for(std::chrono::milliseconds{500});
41
42- static const media::Track::UriType uri{"file:///tmp/test.ogg"};
43+ static const media::Track::UriType uri{"file:///tmp/test-audio.ogg"};
44
45 auto service = media::Service::Client::instance();
46 auto session = service->create_session(media::Player::Client::default_configuration());
47@@ -241,9 +241,9 @@
48
49 TEST(MusicService, DISABLED_play_pause_seek_after_open_uri_works)
50 {
51- const std::string test_file{"/tmp/test.mp3"};
52+ const std::string test_file{"/tmp/test-audio-1.ogg"};
53 std::remove(test_file.c_str());
54- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
55+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio-1.ogg", test_file));
56
57 core::testing::CrossProcessSync sync_service_start;
58
59@@ -268,7 +268,7 @@
60 {
61 sync_service_start.wait_for_signal_ready_for(std::chrono::milliseconds{500});
62
63- static const media::Track::UriType uri{"file:///tmp/test.mp3"};
64+ static const media::Track::UriType uri{"file:///tmp/test-audio-1.ogg"};
65
66 auto service = media::Service::Client::instance();
67 auto session = service->create_session(media::Player::Client::default_configuration());
68@@ -320,9 +320,9 @@
69
70 TEST(MusicService, DISABLED_get_position_duration_work)
71 {
72- const std::string test_file{"/tmp/test.mp3"};
73+ const std::string test_file{"/tmp/test-audio-1.ogg"};
74 std::remove(test_file.c_str());
75- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
76+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio-1.ogg", test_file));
77
78 core::testing::CrossProcessSync sync_service_start;
79
80@@ -347,7 +347,7 @@
81 {
82 sync_service_start.wait_for_signal_ready_for(std::chrono::milliseconds{500});
83
84- static const media::Track::UriType uri{"file:///tmp/test.mp3"};
85+ static const media::Track::UriType uri{"file:///tmp/test-audio-1.ogg"};
86
87 auto service = media::Service::Client::instance();
88 auto session = service->create_session(media::Player::Client::default_configuration());
89@@ -379,9 +379,9 @@
90
91 TEST(MusicService, DISABLED_starting_playback_on_non_empty_playqueue_works)
92 {
93- const std::string test_file{"/tmp/test.mp3"};
94+ const std::string test_file{"/tmp/test-audio-1.ogg"};
95 std::remove(test_file.c_str());
96- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
97+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio-1.ogg", test_file));
98
99 core::testing::CrossProcessSync sync_service_start;
100
101@@ -406,7 +406,7 @@
102 {
103 sync_service_start.wait_for_signal_ready_for(std::chrono::milliseconds{500});
104
105- static const media::Track::UriType uri{"file:///tmp/test.mp3"};
106+ static const media::Track::UriType uri{"file:///tmp/test-audio-1.ogg"};
107 static const bool dont_make_current{false};
108
109 auto service = media::Service::Client::instance();
110
111=== removed file 'tests/h264.avi'
112Binary files tests/h264.avi 2014-01-14 20:31:02 +0000 and tests/h264.avi 1970-01-01 00:00:00 +0000 differ
113=== added file 'tests/test-audio-1.ogg'
114Binary files tests/test-audio-1.ogg 1970-01-01 00:00:00 +0000 and tests/test-audio-1.ogg 2015-03-03 22:54:52 +0000 differ
115=== renamed file 'tests/test.ogg' => 'tests/test-audio.ogg'
116=== added file 'tests/test-video.ogg'
117Binary files tests/test-video.ogg 1970-01-01 00:00:00 +0000 and tests/test-video.ogg 2015-03-03 22:54:52 +0000 differ
118=== added file 'tests/test.mp3'
119Binary files tests/test.mp3 1970-01-01 00:00:00 +0000 and tests/test.mp3 2015-03-03 22:54:52 +0000 differ
120=== removed file 'tests/test.mp3'
121Binary files tests/test.mp3 2013-10-07 11:07:11 +0000 and tests/test.mp3 1970-01-01 00:00:00 +0000 differ
122=== modified file 'tests/test_data.cpp.in'
123--- tests/test_data.cpp.in 2014-01-14 20:31:02 +0000
124+++ tests/test_data.cpp.in 2015-03-03 22:54:52 +0000
125@@ -20,44 +20,9 @@
126
127 #include <boost/filesystem.hpp>
128
129-bool test::copy_test_mp3_file_to(const std::string& dest)
130-{
131- static const std::string file{"@CMAKE_CURRENT_SOURCE_DIR@/test.mp3"};
132- try
133- {
134- boost::filesystem::copy_file(
135- file,
136- dest,
137- boost::filesystem::copy_option::overwrite_if_exists);
138- } catch (const boost::filesystem::filesystem_error& e)
139- {
140- return false;
141- }
142-
143- return true;
144-}
145-
146-bool test::copy_test_ogg_file_to(const std::string& dest)
147-{
148- static const std::string file{"@CMAKE_CURRENT_SOURCE_DIR@/test.ogg"};
149-
150- try
151- {
152- boost::filesystem::copy_file(
153- file,
154- dest,
155- boost::filesystem::copy_option::overwrite_if_exists);
156- } catch (const boost::filesystem::filesystem_error& e)
157- {
158- return false;
159- }
160-
161- return true;
162-}
163-
164-bool test::copy_test_avi_file_to(const std::string& dest)
165-{
166- static const std::string file{"@CMAKE_CURRENT_SOURCE_DIR@/h264.avi"};
167+bool test::copy_test_media_file_to(const std::string& media, const std::string& dest)
168+{
169+ static const std::string file{"@CMAKE_CURRENT_SOURCE_DIR@/" + media};
170
171 try
172 {
173
174=== modified file 'tests/test_data.h'
175--- tests/test_data.h 2014-01-14 20:31:02 +0000
176+++ tests/test_data.h 2015-03-03 22:54:52 +0000
177@@ -23,9 +23,7 @@
178
179 namespace test
180 {
181-bool copy_test_mp3_file_to(const std::string& path);
182-bool copy_test_ogg_file_to(const std::string& path);
183-bool copy_test_avi_file_to(const std::string& path);
184+bool copy_test_media_file_to(const std::string& media, const std::string& path);
185 }
186
187 #endif // TEST_DATA_H_
188
189=== modified file 'tests/unit-tests/test-gstreamer-engine.cpp'
190--- tests/unit-tests/test-gstreamer-engine.cpp 2014-11-18 20:29:26 +0000
191+++ tests/unit-tests/test-gstreamer-engine.cpp 2015-03-03 22:54:52 +0000
192@@ -70,10 +70,10 @@
193
194 TEST(GStreamerEngine, DISABLED_setting_uri_and_starting_audio_only_playback_works)
195 {
196- const std::string test_file{"/tmp/test.ogg"};
197- const std::string test_file_uri{"file:///tmp/test.ogg"};
198+ const std::string test_file{"/tmp/test-audio.ogg"};
199+ const std::string test_file_uri{"file:///tmp/test-audio.ogg"};
200 std::remove(test_file.c_str());
201- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
202+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio.ogg", test_file));
203
204 core::testing::WaitableStateTransition<core::ubuntu::media::Engine::State> wst(
205 core::ubuntu::media::Engine::State::ready);
206@@ -115,10 +115,10 @@
207
208 TEST(GStreamerEngine, DISABLED_setting_uri_and_starting_video_playback_works)
209 {
210- const std::string test_file{"/tmp/h264.avi"};
211- const std::string test_file_uri{"file:///tmp/h264.avi"};
212+ const std::string test_file{"/tmp/test-video.ogg"};
213+ const std::string test_file_uri{"file:///tmp/test-video.ogg"};
214 std::remove(test_file.c_str());
215- ASSERT_TRUE(test::copy_test_avi_file_to(test_file));
216+ ASSERT_TRUE(test::copy_test_media_file_to("test-video.ogg", test_file));
217 // Make sure a video sink is added to the pipeline
218 const EnsureFakeVideoSinkEnvVarIsSet efs;
219
220@@ -157,9 +157,9 @@
221
222 TEST(GStreamerEngine, setting_uri_and_audio_playback_with_http_headers_works)
223 {
224- const std::string test_file{"/tmp/test.mp3"};
225+ const std::string test_file{"/tmp/test-audio-1.ogg"};
226 std::remove(test_file.c_str());
227- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
228+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio-1.ogg", test_file));
229
230 const std::string test_audio_uri{"http://localhost:5000"};
231 const core::ubuntu::media::Player::HeadersType headers{{ "User-Agent", "MediaHub" }, { "Cookie", "A=B;X=Y" }};
232@@ -218,10 +218,10 @@
233
234 TEST(GStreamerEngine, DISABLED_stop_pause_play_seek_audio_only_works)
235 {
236- const std::string test_file{"/tmp/test.ogg"};
237- const std::string test_file_uri{"file:///tmp/test.ogg"};
238+ const std::string test_file{"/tmp/test-audio.ogg"};
239+ const std::string test_file_uri{"file:///tmp/test-audio.ogg"};
240 std::remove(test_file.c_str());
241- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
242+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio.ogg", test_file));
243
244 core::testing::WaitableStateTransition<core::ubuntu::media::Engine::State> wst(
245 core::ubuntu::media::Engine::State::ready);
246@@ -264,10 +264,10 @@
247
248 TEST(GStreamerEngine, DISABLED_stop_pause_play_seek_video_works)
249 {
250- const std::string test_file{"/tmp/h264.avi"};
251- const std::string test_file_uri{"file:///tmp/h264.avi"};
252+ const std::string test_file{"/tmp/test-video.ogg"};
253+ const std::string test_file_uri{"file:///tmp/test-video.ogg"};
254 std::remove(test_file.c_str());
255- ASSERT_TRUE(test::copy_test_avi_file_to(test_file));
256+ ASSERT_TRUE(test::copy_test_media_file_to("test-video.ogg", test_file));
257 // Make sure a video sink is added to the pipeline
258 const EnsureFakeVideoSinkEnvVarIsSet efs;
259
260@@ -312,10 +312,10 @@
261
262 TEST(GStreamerEngine, get_position_duration_work)
263 {
264- const std::string test_file{"/tmp/h264.avi"};
265- const std::string test_file_uri{"file:///tmp/h264.avi"};
266+ const std::string test_file{"/tmp/test-video.ogg"};
267+ const std::string test_file_uri{"file:///tmp/test-video.ogg"};
268 std::remove(test_file.c_str());
269- ASSERT_TRUE(test::copy_test_avi_file_to(test_file));
270+ ASSERT_TRUE(test::copy_test_media_file_to("test-video.ogg", test_file));
271
272 core::testing::WaitableStateTransition<core::ubuntu::media::Engine::State> wst(
273 core::ubuntu::media::Engine::State::ready);
274@@ -343,16 +343,16 @@
275 std::cout << "position: " << engine.position() << std::endl;
276 std::cout << "duration: " << engine.duration() << std::endl;
277
278- EXPECT_TRUE(engine.position() > 10e9);
279- EXPECT_TRUE(engine.duration() > 10e9);
280+ EXPECT_TRUE(engine.position() > 9e9);
281+ EXPECT_TRUE(engine.duration() > 9e9);
282 }
283
284 TEST(GStreamerEngine, adjusting_volume_works)
285 {
286- const std::string test_file{"/tmp/test.mp3"};
287- const std::string test_file_uri{"file:///tmp/test.mp3"};
288+ const std::string test_file{"/tmp/test-audio-1.ogg"};
289+ const std::string test_file_uri{"file:///tmp/test-audio-1.ogg"};
290 std::remove(test_file.c_str());
291- ASSERT_TRUE(test::copy_test_mp3_file_to(test_file));
292+ ASSERT_TRUE(test::copy_test_media_file_to("test-audio-1.ogg", test_file));
293
294 core::testing::WaitableStateTransition<core::ubuntu::media::Engine::State> wst(
295 core::ubuntu::media::Engine::State::ready);
296@@ -399,10 +399,10 @@
297
298 TEST(GStreamerEngine, meta_data_extractor_provides_correct_tags)
299 {
300- const std::string test_file{"/tmp/test.ogg"};
301- const std::string test_file_uri{"file:///tmp/test.ogg"};
302+ const std::string test_file{"/tmp/test.mp3"};
303+ const std::string test_file_uri{"file:///tmp/test.mp3"};
304 std::remove(test_file.c_str());
305- ASSERT_TRUE(test::copy_test_ogg_file_to(test_file));
306+ ASSERT_TRUE(test::copy_test_media_file_to("test.mp3", test_file));
307
308 gstreamer::Engine engine;
309 auto md = engine.meta_data_extractor()->meta_data_for_track_with_uri(test_file_uri);
310@@ -412,9 +412,9 @@
311 if (0 < md.count(xesam::AlbumArtist::name))
312 EXPECT_EQ("Test", md.get(xesam::AlbumArtist::name));
313 if (0 < md.count(xesam::Artist::name))
314- EXPECT_EQ("Test", md.get(xesam::Artist::name));
315+ EXPECT_EQ("Ezwa", md.get(xesam::Artist::name));
316 if (0 < md.count(xesam::DiscNumber::name))
317- EXPECT_EQ("42", md.get(xesam::DiscNumber::name));
318+ EXPECT_EQ("1", md.get(xesam::DiscNumber::name));
319 if (0 < md.count(xesam::Genre::name))
320 EXPECT_EQ("Test", md.get(xesam::Genre::name));
321 if (0 < md.count(xesam::TrackNumber::name))

Subscribers

People subscribed via source and target branches