~ci-train-bot/ubuntu-system-settings/ubuntu-system-settings-ubuntu-zesty-2679

« back to all changes in this revision

Viewing changes to tests/mocks/plugins/system-update/faketokendownloader_factory.h

  • Committer: Ken VanDine
  • Date: 2017-03-15 19:17:14 UTC
  • mto: This revision was merged to the branch mainline in revision 1766.
  • Revision ID: ken.vandine@canonical.com-20170315191714-1appjzosayvmf246
removed more click/updates stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of system-settings
3
 
 *
4
 
 * Copyright (C) 2016 Canonical Ltd.
5
 
 *
6
 
 * This program is free software: you can redistribute it and/or modify it
7
 
 * under the terms of the GNU General Public License version 3, as published
8
 
 * by the Free Software Foundation.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful, but
11
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
12
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
 
 * PURPOSE.  See the GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License along
16
 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 
 */
18
 
 
19
 
 
20
 
#ifndef FAKE_TOKEN_DOWNLOADERFACTORY_H
21
 
#define FAKE_TOKEN_DOWNLOADERFACTORY_H
22
 
 
23
 
#include "update.h"
24
 
#include "click/tokendownloader.h"
25
 
#include "click/tokendownloader_factory.h"
26
 
#include "network/accessmanager.h"
27
 
 
28
 
#include "faketokendownloader.h"
29
 
#include "fakeapiclient.h"
30
 
 
31
 
using namespace UpdatePlugin;
32
 
 
33
 
class MockTokenDownloaderFactory
34
 
    : public Click::TokenDownloaderFactory
35
 
{
36
 
public:
37
 
    virtual Click::TokenDownloader* create(Network::Manager *nam,
38
 
                                           QSharedPointer<Update> update
39
 
    ) override
40
 
    {
41
 
        Q_UNUSED(nam);
42
 
        Click::ApiClient *client = new MockApiClient();
43
 
        MockTokenDownloader *d = new MockTokenDownloader(client, update);
44
 
        client->setParent(d);
45
 
        created.append(d);
46
 
        return d;
47
 
    }
48
 
 
49
 
    QList<MockTokenDownloader* > created;
50
 
};
51
 
 
52
 
#endif // FAKE_TOKEN_DOWNLOADERFACTORY_H