/*
* Copyright (C) 2015 Canonical, Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*
* Author: Xavi Garcia
*/
#pragma once
#include
#include
#include
#include
#include
#include
#include
class MenusInterface;
class DBusPulseVolume;
class DBusPropertiesInterface;
class QSignalSpy;
class IndicatorSoundTestBase: public testing::Test
{
public:
IndicatorSoundTestBase();
~IndicatorSoundTestBase();
protected:
void SetUp() override;
void TearDown() override;
void startIndicator();
void startPulseDesktop();
void startPulsePhone();
void startAccountsService();
bool clearGSettingsPlayers();
bool startTestMprisPlayer(QString const& playerName);
bool setTestMprisPlayerProperty(QString const &testPlayer, QString const &property, bool value);
bool setStreamRestoreVolume(QString const &role, double volume);
bool setSinkVolume(double volume);
bool startTestSound(QString const &role);
void stopTestSound();
static std::shared_ptr volume_variant(double volume);
static unity::gmenuharness::MenuMatcher::Parameters desktopParameters();
static unity::gmenuharness::MenuMatcher::Parameters phoneParameters();
static unity::gmenuharness::MenuItemMatcher volumeSlider(double volume);
static unity::gmenuharness::MenuItemMatcher silentModeSwitch(bool toggled);
bool waitMenuChange();
bool waitVolumeChangedInIndicator();
void initializeAccountsInterface();
QtDBusTest::DBusTestRunner dbusTestRunner;
QtDBusMock::DBusMock dbusMock;
QtDBusTest::DBusServicePtr indicator;
QtDBusTest::DBusServicePtr pulseaudio;
QtDBusTest::DBusServicePtr accountsService;
QProcess testSoundProcess;
QProcess testPlayer1;
std::unique_ptr menu_interface_;
std::unique_ptr accounts_interface_;
std::unique_ptr signal_spy_volume_changed_;
};