~kgunn72/mir/dont-crash-when-shooting-invalid-surface

« back to all changes in this revision

Viewing changes to include/test/mir_test_framework/in_process_server.h

  • Committer: Tarmac
  • Author(s): Alan Griffiths, Alexandros Frantzis, Daniel van Vugt, Kevin DuBois, Christopher James Halse Rogers, chris.gagnon, Mathieu Trudel-Lapierre, Robert Carr, Automatic PS uploader, Kevin Gunn, Daniel d'Andrada, Christopher James Halse Rogers, Michael Terry, Brandon Schaefer, Timo Jyrinki, Mir Team, Andreas Pokorny
  • Date: 2013-12-20 11:11:22 UTC
  • mfrom: (1169.1.1 version-0.1.3)
  • Revision ID: tarmac-20131220111122-h503fd1fnq7pn9za
Latest upstream release: Mir 0.1.3 (r1298).

Approved by Alan Griffiths, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3,
 
6
 * as 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
#ifndef MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_
 
20
#define MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_
 
21
 
 
22
#include <gtest/gtest.h>
 
23
 
 
24
#include <string>
 
25
#include <thread>
 
26
 
 
27
namespace mir
 
28
{
 
29
class DisplayServer;
 
30
class DefaultServerConfiguration;
 
31
}
 
32
 
 
33
 
 
34
namespace mir_test_framework
 
35
{
 
36
/// Fixture for running Mir server in test process
 
37
struct InProcessServer : testing::Test
 
38
{
 
39
    ~InProcessServer();
 
40
 
 
41
    /// Starts the server
 
42
    /// \warning don't forget to call this if you override SetUp()
 
43
    void SetUp() override;
 
44
 
 
45
    /// Stops the server
 
46
    /// \warning don't forget to call this if you override TearDown()
 
47
    void TearDown() override;
 
48
 
 
49
    /// \return a connection string for a new client to connect to the server
 
50
    std::string new_connection();
 
51
 
 
52
private:
 
53
    mir::DisplayServer* start_mir_server();
 
54
    virtual mir::DefaultServerConfiguration& server_config() = 0;
 
55
 
 
56
    std::thread server_thread;
 
57
    mir::DisplayServer* display_server = 0;
 
58
};
 
59
}
 
60
 
 
61
#endif /* MIR_TEST_FRAMEWORK_IN_PROCESS_SERVER_H_ */