~ci-train-bot/qtmir/qtmir-ubuntu-zesty-2668

« back to all changes in this revision

Viewing changes to tests/framework/mock_sessionmap.h

Stop MirSurface deleting itself, ensure SurfaceManager alone manages MirSurface lifetimes. Add SurfaceManager test suite.

This fixes bugs where a MirSurface would call deleteLater on itself, but SurfaceManager would have no idea and keep a pointer to that MirSurface in its internal list.

Instead SurfaceManager listens for signals from both miral and the MirSurface itself to decide when to delete it.

Add a test suite to verify MirSurface lifetimes. (LP: #1655644)

Approved by: Daniel d'Andrada, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2017 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it under
 
5
 * the terms of the GNU Lesser General Public License version 3, as published by
 
6
 * the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
9
 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
 
10
 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * 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
 
 
17
#ifndef MOCK_SESSIONMAP_H
 
18
#define MOCK_SESSIONMAP_H
 
19
 
 
20
#include <gmock/gmock.h>
 
21
 
 
22
#include <Unity/Application/sessionmap_interface.h>
 
23
 
 
24
struct MockSessionMap : public qtmir::SessionMapInterface
 
25
{
 
26
    MockSessionMap() {}
 
27
    virtual ~MockSessionMap() {}
 
28
 
 
29
    MOCK_CONST_METHOD1(findSession, SessionInterface*(const mir::scene::Session*));
 
30
};
 
31
 
 
32
#endif // MOCK_SESSIONMAP_H