~kdub/mir/mali-client-render-support

« back to all changes in this revision

Viewing changes to tests/unit-tests/shell/test_application_session.cpp

  • Committer: Kevin DuBois
  • Date: 2013-10-15 00:13:54 UTC
  • mfrom: (1062.1.71 development-branch)
  • Revision ID: kevin.dubois@canonical.com-20131015001354-2j44ml0vsg5lcpe2
merge in dev branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    ON_CALL(surface_factory, create_surface(_,_,_,_)).WillByDefault(Return(mock_surface));
66
66
 
67
67
    EXPECT_CALL(surface_factory, create_surface(_, _, _, _));
68
 
    EXPECT_CALL(*mock_surface, destroy());
69
68
    
70
69
    mtd::MockSessionListener listener;
71
70
    EXPECT_CALL(listener, surface_created(_, _)).Times(1);
82
81
    session.destroy_surface(surf);
83
82
}
84
83
 
 
84
TEST(ApplicationSession, listener_notified_of_surface_destruction_on_session_destruction)
 
85
{
 
86
    using namespace ::testing;
 
87
 
 
88
    auto mock_surface = make_mock_surface();
 
89
 
 
90
    mtd::NullEventSink sender;
 
91
    mtd::MockSurfaceFactory surface_factory;
 
92
    ON_CALL(surface_factory, create_surface(_,_,_,_)).WillByDefault(Return(mock_surface));
 
93
 
 
94
    EXPECT_CALL(surface_factory, create_surface(_, _, _, _));
 
95
    
 
96
    mtd::MockSessionListener listener;
 
97
    EXPECT_CALL(listener, surface_created(_, _)).Times(1);
 
98
    EXPECT_CALL(listener, destroying_surface(_, _)).Times(1);
 
99
 
 
100
    {
 
101
        msh::ApplicationSession session(mt::fake_shared(surface_factory), "Foo",
 
102
            std::make_shared<mtd::NullSnapshotStrategy>(), mt::fake_shared(listener),
 
103
                mt::fake_shared(sender));
 
104
 
 
105
        msh::SurfaceCreationParameters params;
 
106
        session.create_surface(params);
 
107
    }
 
108
}
 
109
 
85
110
TEST(ApplicationSession, default_surface_is_first_surface)
86
111
{
87
112
    using namespace ::testing;
142
167
        InSequence seq;
143
168
        EXPECT_CALL(*mock_surface, hide()).Times(1);
144
169
        EXPECT_CALL(*mock_surface, show()).Times(1);
145
 
        EXPECT_CALL(*mock_surface, destroy()).Times(1);
146
170
    }
147
171
 
148
172
    msh::SurfaceCreationParameters params;