~bregma/qtmir/use-ual-info

« back to all changes in this revision

Viewing changes to tests/framework/mock_session.h

  • Committer: Michael Terry
  • Date: 2016-02-18 17:27:58 UTC
  • mfrom: (434.2.16 qtmir)
  • Revision ID: michael.terry@canonical.com-20160218172758-j78qsba4zsl77imj
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
class MockSession : public SessionInterface {
26
26
public:
27
 
    MockSession() : SessionInterface(0) {
28
 
        m_state = Starting;
29
 
        ON_CALL(*this, suspend()).WillByDefault(::testing::Invoke(this, &MockSession::doSuspend));
30
 
        ON_CALL(*this, resume()).WillByDefault(::testing::Invoke(this, &MockSession::doResume));
31
 
        ON_CALL(*this, stop()).WillByDefault(::testing::Invoke(this, &MockSession::doStop));
32
 
        ON_CALL(*this, state()).WillByDefault(::testing::Invoke(this, &MockSession::doState));
33
 
    }
 
27
    MockSession();
 
28
    virtual ~MockSession();
34
29
 
35
30
    MOCK_METHOD0(release, void());
36
31
 
66
61
    MOCK_CONST_METHOD0(activePromptSession, std::shared_ptr<mir::scene::PromptSession>());
67
62
    MOCK_CONST_METHOD1(foreachPromptSession, void(std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> f));
68
63
 
69
 
    void setState(State state) {
70
 
        if (m_state != state) {
71
 
            m_state = state;
72
 
            Q_EMIT stateChanged(m_state);
73
 
        }
74
 
    }
 
64
    void setState(State state);
75
65
 
76
 
    void doSuspend() {
77
 
        if (m_state == Running) {
78
 
            setState(Suspending);
79
 
        }
80
 
    }
81
 
    void doResume() {
82
 
        if (m_state == Suspending || m_state == Suspended) {
83
 
            setState(Running);
84
 
        }
85
 
    }
86
 
    void doStop() {
87
 
        setState(Stopped);
88
 
    }
89
 
    State doState() const {
90
 
        return m_state;
91
 
    }
 
66
    void doSuspend();
 
67
    void doResume();
 
68
    void doStop();
 
69
    State doState() const;
92
70
 
93
71
protected:
94
72
    MOCK_METHOD1(setFullscreen, void(bool fullscreen));
97
75
    MOCK_METHOD1(removePromptSession, void(const std::shared_ptr<mir::scene::PromptSession>& session));
98
76
 
99
77
private:
100
 
 
101
78
    State m_state;
102
79
};
103
80