~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_test_framework.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-11-20 16:41:15 UTC
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: package-import@ubuntu.com-20141120164115-a3j4vq6cq2u78m47
Tags: upstream-0.9.0+15.04.20141120.1
Import upstream version 0.9.0+15.04.20141120.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2012, 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify
5
 
 * it under the terms of the GNU 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 General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17
 
 */
18
 
 
19
 
#include "mir_test_framework/display_server_test_fixture.h"
20
 
#include "mir_test_framework/testing_server_configuration.h"
21
 
#include "mir_test_framework/in_process_server.h"
22
 
#include "mir_test_framework/using_stub_client_platform.h"
23
 
 
24
 
#include "mir_toolkit/mir_client_library.h"
25
 
 
26
 
#include <gmock/gmock.h>
27
 
#include <gtest/gtest.h>
28
 
 
29
 
#include <thread>
30
 
#include <list>
31
 
 
32
 
namespace mf = mir::frontend;
33
 
 
34
 
// We need some tests to prove that errors are reported by the
35
 
// display server test fixture.  But don't want them to fail in
36
 
// normal builds.
37
 
TEST_F(BespokeDisplayServerTestFixture, DISABLED_failing_server_side_test)
38
 
{
39
 
    struct Server : TestingServerConfiguration
40
 
    {
41
 
        void exec()
42
 
        {
43
 
            using namespace testing;
44
 
            FAIL() << "Proving a test can fail";
45
 
        }
46
 
    } fail;
47
 
 
48
 
    launch_server_process(fail);
49
 
}
50
 
 
51
 
TEST_F(BespokeDisplayServerTestFixture, DISABLED_failing_without_server)
52
 
{
53
 
}
54
 
 
55
 
TEST_F(DefaultDisplayServerTestFixture, demonstrate_multiple_clients)
56
 
{
57
 
    struct Client : TestingClientConfiguration
58
 
    {
59
 
        void exec()
60
 
        {
61
 
            SCOPED_TRACE("Demo Client");
62
 
        }
63
 
    } demo;
64
 
 
65
 
    for(int i = 0; i != 10; ++i)
66
 
    {
67
 
        launch_client_process(demo);
68
 
    }
69
 
}
70
 
 
71
 
namespace
72
 
{
73
 
struct DemoInProcessServer : mir_test_framework::InProcessServer
74
 
{
75
 
    virtual mir::DefaultServerConfiguration& server_config() { return server_config_; }
76
 
 
77
 
    mir_test_framework::StubbedServerConfiguration server_config_;
78
 
    mir_test_framework::UsingStubClientPlatform using_stub_client_platform;
79
 
};
80
 
}
81
 
 
82
 
TEST_F(DemoInProcessServer, client_can_connect)
83
 
{
84
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
85
 
    EXPECT_TRUE(mir_connection_is_valid(connection));
86
 
 
87
 
    mir_connection_release(connection);
88
 
}