~kdub/+junk/direct

« back to all changes in this revision

Viewing changes to tests/mir_test_doubles/test_protobuf_client.cpp

  • Committer: Kevin DuBois
  • Date: 2016-04-05 13:15:56 UTC
  • mfrom: (3359.35.30 development-branch)
  • Revision ID: kevin.dubois@canonical.com-20160405131556-asujsjoxqdkombmi
mergeĀ inĀ mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    maxwait(timeout_ms),
58
58
    connect_done_called(false),
59
59
    create_surface_called(false),
60
 
    next_buffer_called(false),
61
60
    exchange_buffer_called(false),
62
61
    disconnect_done_called(false),
63
62
    configure_display_done_called(false),
75
74
        .WillByDefault(testing::Invoke(this, &TestProtobufClient::on_connect_done));
76
75
    ON_CALL(*this, create_surface_done())
77
76
        .WillByDefault(testing::Invoke(this, &TestProtobufClient::on_create_surface_done));
78
 
    ON_CALL(*this, next_buffer_done())
79
 
        .WillByDefault(testing::Invoke(this, &TestProtobufClient::on_next_buffer_done));
 
77
    ON_CALL(*this, exchange_buffer_done())
 
78
        .WillByDefault(testing::Invoke(this, &TestProtobufClient::on_exchange_buffer_done));
80
79
    ON_CALL(*this, disconnect_done())
81
80
        .WillByDefault(testing::Invoke(this, &TestProtobufClient::on_disconnect_done));
82
81
    ON_CALL(*this, display_configure_done())
109
108
    cv.notify_all();
110
109
}
111
110
 
112
 
void mir::test::TestProtobufClient::on_next_buffer_done()
 
111
void mir::test::TestProtobufClient::on_exchange_buffer_done()
113
112
{
114
 
    signal_condition(next_buffer_called);
 
113
    signal_condition(exchange_buffer_called);
115
114
}
116
115
 
117
116
void mir::test::TestProtobufClient::on_disconnect_done()
151
150
        google::protobuf::NewCallback(this, &TestProtobufClient::create_surface_done));
152
151
}
153
152
 
154
 
void mir::test::TestProtobufClient::next_buffer()
 
153
void mir::test::TestProtobufClient::exchange_buffer()
155
154
{
156
 
    reset_condition(next_buffer_called);
157
 
    display_server.next_buffer(
158
 
        &surface.id(),
 
155
    reset_condition(exchange_buffer_called);
 
156
    display_server.exchange_buffer(
 
157
        &buffer_request,
159
158
        surface.mutable_buffer(),
160
 
        google::protobuf::NewCallback(this, &TestProtobufClient::next_buffer_done));
 
159
        google::protobuf::NewCallback(this, &TestProtobufClient::exchange_buffer_done));
161
160
}
162
161
 
163
162
void mir::test::TestProtobufClient::configure_display()
184
183
    wait_for([this]{ return create_surface_called; }, "Timed out waiting create surface");
185
184
}
186
185
 
187
 
void mir::test::TestProtobufClient::wait_for_next_buffer()
 
186
void mir::test::TestProtobufClient::wait_for_exchange_buffer()
188
187
{
189
 
    wait_for([this] { return next_buffer_called; }, "Timed out waiting for next buffer");
 
188
    wait_for([this] { return exchange_buffer_called; }, "Timed out waiting for next buffer");
190
189
}
191
190
 
192
191
void mir::test::TestProtobufClient::wait_for_disconnect_done()