Merge lp:~ted/indicator-sound/null-selected-user into lp:indicator-sound/14.04

Proposed by Ted Gould
Status: Superseded
Proposed branch: lp:~ted/indicator-sound/null-selected-user
Merge into: lp:indicator-sound/14.04
Diff against target: 116 lines (+92/-1)
3 files modified
src/media-player-list-greeter.vala (+1/-1)
tests/CMakeLists.txt (+23/-0)
tests/greeter-list.cc (+68/-0)
To merge this branch: bzr merge lp:~ted/indicator-sound/null-selected-user
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Indicator Applet Developers Pending
Review via email: mp+212617@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-25.

Commit message

Check the username has been gotten before using it.

Description of the change

Seems that in some cases on startup we can get asked for the list of players before we get the information from the greeter on the selected user. Adding a test that fails on trunk, but is fixed by this branch where we test the greeter list with nothing else on DBus so we can ensure it'll never have the username.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
439. By Ted Gould

Grab test fix

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/media-player-list-greeter.vala'
2--- src/media-player-list-greeter.vala 2014-03-03 19:28:24 +0000
3+++ src/media-player-list-greeter.vala 2014-03-25 13:55:39 +0000
4@@ -108,7 +108,7 @@
5 public override MediaPlayer? next_value () {
6 MediaPlayer? retval = null;
7
8- if (i == 0) {
9+ if (i == 0 && list.selected_user != null) {
10 retval = list.players.lookup(list.selected_user);
11 }
12 i++;
13
14=== modified file 'tests/CMakeLists.txt'
15--- tests/CMakeLists.txt 2014-03-04 21:24:10 +0000
16+++ tests/CMakeLists.txt 2014-03-25 13:55:39 +0000
17@@ -158,3 +158,26 @@
18 media-player-user-test --gtest_filter=MediaPlayerUserTest.TimeoutTest
19 )
20
21+###########################
22+# Greeter List
23+###########################
24+
25+include_directories(${CMAKE_SOURCE_DIR}/src)
26+add_executable (greeter-list-test greeter-list.cc)
27+target_link_libraries (
28+ greeter-list-test
29+ indicator-sound-service-lib
30+ vala-mocks-lib
31+ gtest
32+ ${SOUNDSERVICE_LIBRARIES}
33+ ${TEST_LIBRARIES}
34+)
35+
36+# Split tests to work around libaccountservice sucking
37+add_test(greeter-list-test-basic
38+ greeter-list-test --gtest_filter=GreeterListTest.BasicObject
39+)
40+add_test(greeter-list-test-iterator
41+ greeter-list-test --gtest_filter=GreeterListTest.BasicIterator
42+)
43+
44
45=== added file 'tests/greeter-list.cc'
46--- tests/greeter-list.cc 1970-01-01 00:00:00 +0000
47+++ tests/greeter-list.cc 2014-03-25 13:55:39 +0000
48@@ -0,0 +1,68 @@
49+/*
50+ * Copyright © 2014 Canonical Ltd.
51+ *
52+ * This program is free software; you can redistribute it and/or modify
53+ * it under the terms of the GNU General Public License as published by
54+ * the Free Software Foundation; version 3.
55+ *
56+ * This program is distributed in the hope that it will be useful,
57+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
58+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59+ * GNU General Public License for more details.
60+ *
61+ * You should have received a copy of the GNU General Public License
62+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
63+ *
64+ * Authors:
65+ * Ted Gould <ted@canonical.com>
66+ */
67+
68+#include <gtest/gtest.h>
69+#include <gio/gio.h>
70+
71+extern "C" {
72+#include "indicator-sound-service.h"
73+#include "vala-mocks.h"
74+}
75+
76+class GreeterListTest : public ::testing::Test
77+{
78+ protected:
79+ GTestDBus * bus = nullptr;
80+
81+ virtual void SetUp() {
82+ bus = g_test_dbus_new(G_TEST_DBUS_NONE);
83+ g_test_dbus_up(bus);
84+ }
85+
86+ virtual void TearDown() {
87+ g_test_dbus_down(bus);
88+ g_clear_object(&bus);
89+ }
90+
91+};
92+
93+TEST_F(GreeterListTest, BasicObject) {
94+ MediaPlayerListGreeter * list = media_player_list_greeter_new();
95+
96+ ASSERT_NE(nullptr, list);
97+
98+ g_clear_object(&list);
99+ return;
100+}
101+
102+TEST_F(GreeterListTest, BasicIterator) {
103+ MediaPlayerListGreeter * list = media_player_list_greeter_new();
104+ ASSERT_NE(nullptr, list);
105+
106+ MediaPlayerListGreeterIterator * iter = media_player_list_greeter_iterator_new(list);
107+ ASSERT_NE(nullptr, iter);
108+
109+ MediaPlayer * player = media_player_list_iterator_next_value (MEDIA_PLAYER_LIST_ITERATOR(iter));
110+ ASSERT_EQ(nullptr, player);
111+
112+ g_clear_object(&iter);
113+ g_clear_object(&list);
114+ return;
115+}
116+

Subscribers

People subscribed via source and target branches