~michihenning/storage-framework/stand-alone-provider-headers

« back to all changes in this revision

Viewing changes to tests/utils/ProviderFixture.h

  • Committer: Michi Henning
  • Date: 2016-08-23 23:45:34 UTC
  • mfrom: (53.1.4 devel)
  • Revision ID: michi.henning@canonical.com-20160823234534-4owayhnhcp67g39q
Merged devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors: James Henstridge <james.henstridge@canonical.com>
 
17
 */
 
18
 
 
19
#pragma once
 
20
 
 
21
#include <unity/storage/provider/ProviderBase.h>
 
22
#include <unity/storage/provider/testing/TestServer.h>
 
23
#include <utils/DBusEnvironment.h>
 
24
#include <utils/ProviderClient.h>
 
25
 
 
26
#include <gtest/gtest.h>
 
27
#include <OnlineAccounts/Account>
 
28
#include <OnlineAccounts/Manager>
 
29
#include <QDBusConnection>
 
30
 
 
31
#include <memory>
 
32
 
 
33
class ProviderFixture : public ::testing::Test
 
34
{
 
35
public:
 
36
    ProviderFixture();
 
37
    virtual ~ProviderFixture();
 
38
 
 
39
    QDBusConnection const& connection() const;
 
40
    void set_provider(std::unique_ptr<unity::storage::provider::ProviderBase>&& provider);
 
41
    void wait_for(QDBusPendingCall const& call);
 
42
    QString bus_path() const;
 
43
 
 
44
protected:
 
45
    std::unique_ptr<DBusEnvironment> dbus_;
 
46
    std::unique_ptr<QDBusConnection> service_connection_;
 
47
    std::unique_ptr<OnlineAccounts::Manager> account_manager_;
 
48
    std::unique_ptr<unity::storage::provider::testing::TestServer> test_server_;
 
49
};