~tiagosh/telephony-service/remove_ofono_dependency

« back to all changes in this revision

Viewing changes to tests/libtelephonyservice/MultimediaAccountEntryTest.cpp

  • Committer: CI Train Bot
  • Author(s): Tiago Salem Herrmann
  • Date: 2015-06-17 20:39:34 UTC
  • mfrom: (1078.2.9 add-multimedia-cm)
  • Revision ID: ci-train-bot@canonical.com-20150617203934-95febufyhpv6a67j
Add multimedia connection manager support
Approved by: Gustavo Pichorim Boiko, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical, Ltd.
 
3
 *
 
4
 * This file is part of telephony-service.
 
5
 *
 
6
 * telephony-service is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * telephony-service is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#include <QtCore/QObject>
 
20
#include <QtTest/QtTest>
 
21
#include "telepathytest.h"
 
22
#include "multimediaaccountentry.h"
 
23
#include "accountentryfactory.h"
 
24
#include "mockcontroller.h"
 
25
 
 
26
class MultimediaAccountEntryTest : public TelepathyTest
 
27
{
 
28
    Q_OBJECT
 
29
 
 
30
private Q_SLOTS:
 
31
    void initTestCase();
 
32
    void init();
 
33
    void cleanup();
 
34
    void testAccountType();
 
35
 
 
36
private:
 
37
    MultimediaAccountEntry *mAccount;
 
38
    Tp::AccountPtr mMultimediaAccount;
 
39
    MockController *mMockController;
 
40
};
 
41
 
 
42
void MultimediaAccountEntryTest::initTestCase()
 
43
{
 
44
    initialize();
 
45
}
 
46
 
 
47
void MultimediaAccountEntryTest::init()
 
48
{
 
49
    mMultimediaAccount = addAccount("mock", "multimedia", "multimedia account");
 
50
    QVERIFY(!mMultimediaAccount.isNull());
 
51
    mAccount = qobject_cast<MultimediaAccountEntry*>(AccountEntryFactory::createEntry(mMultimediaAccount, this));
 
52
    QVERIFY(mAccount);
 
53
    TRY_VERIFY(mAccount->ready());
 
54
 
 
55
    // make sure the connection is available
 
56
    TRY_VERIFY(mAccount->connected());
 
57
 
 
58
    // and make sure the status and status message are the ones we expect
 
59
    TRY_COMPARE(mAccount->status(), QString("available"));
 
60
 
 
61
    // create the mock controller
 
62
    mMockController = new MockController("multimedia", this);
 
63
}
 
64
 
 
65
void MultimediaAccountEntryTest::cleanup()
 
66
{
 
67
    doCleanup();
 
68
    mAccount->deleteLater();
 
69
    mMockController->deleteLater();
 
70
}
 
71
 
 
72
void MultimediaAccountEntryTest::testAccountType()
 
73
{
 
74
    QCOMPARE(mAccount->type(), AccountEntry::MultimediaAccount);
 
75
}
 
76
 
 
77
QTEST_MAIN(MultimediaAccountEntryTest)
 
78
#include "MultimediaAccountEntryTest.moc"