~hikiko/mir/mir.unity8-desktop-session

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/android/test_android_fb.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2013-11-20 07:36:15 UTC
  • mfrom: (1.1.52)
  • Revision ID: package-import@ubuntu.com-20131120073615-47my1n59hszj1y6z
Tags: 0.1.1+14.04.20131120-0ubuntu1
[ Daniel van Vugt ]
* New upstream release 0.1.1
  - Add unit tests for V/H scroll events.
  - surfaces: avoid publishing some internal headers, tidy up default
    configuration, integrate surfaces report.
  - client: Add mir_connection_drm_set_gbm_device()
  - graphics: avoid publishing some internal headers.
  - Fixed: unity-system-compositor FTBFS on trusty against new Mir
    (libmirserver9) (LP: #1244192)
  - compositor: avoid publishing some internal headers.
  - shell: Add set_lifecycle_state() to the Session interface.
  - frontend: avoid publishing some internal headers
  - logging: avoid publishing some internal headers.
  - Allow specifying the nested server name by passing --name= or setting
    MIR_SERVER_NAME=.
  - graphics,gbm: Inform the EGL platform about the used gbm device when
    using the native GBM platform
  - examples: Restore GL state after initializing buffers, fixing crashes 
    observed in render_surfaces (LP: #1234563)
  - Continue refactoring the mir android display classes.
  - shell: Hoist focus control functions needed by unity-mir into
    FocusController interface
  - client: Remove the timeout for detecting server crashes
  - Avoid a race condition that could lead to spurious failures of server
    shutdown tests (LP: #1245336)
  - test_client_input.cpp: Bump reception time-out in client test fixture.
    (LP: #1227683)
  - Ensure StubBufferAllocator returns buffers with the properties requested,
    and not the same old hardcoded constants.
  - Update docs and scripting for trusty.
  - compositor: Make DefaultDisplayBufferCompositorFactory private to the
    compositor component.
  - Ignore warnings clang treats as errors, about unused functions being
    generated from macros in <lttng/tracepoint.h> (LP: #1246590)
  - Add resize() support to BufferBundle. This is the first step and lowest
    level of surface resize support.
  - Clean up constants relating to SwitchingBundle.
  - Fix the armhf chroot setup script to point to the right library, so
    cross compiling can work again (LP: #1246975)
  - shell: avoid publishing some internal headers.
  - input: avoid publishing some internal headers.
* Bump timeouts used in socket testing. It seems 100ms isn't always
  enough, which leads to spurious test failures (LP: #1252144) (LP:
  #1252144)
* Fix uninitialized variable causing random drm_auth_magic test
  failures. (LP: #1252144). (LP: #1252144)

[ Ubuntu daily release ]
* Automatic snapshot from revision 1165

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "mir/logging/logger.h"
22
22
#include "src/server/graphics/android/android_display.h"
23
23
#include "src/server/graphics/android/display_buffer_factory.h"
24
 
#include "mir_test_doubles/mock_android_framebuffer_window.h"
25
24
#include "mir_test_doubles/mock_display_report.h"
26
25
#include "mir_test_doubles/mock_egl.h"
27
 
#include "mir_test_doubles/stub_display_support_provider.h"
 
26
#include "mir_test_doubles/stub_display_device.h"
 
27
#include "mir/graphics/android/mir_native_window.h"
 
28
#include "mir_test_doubles/stub_driver_interpreter.h"
28
29
 
29
30
#include <gtest/gtest.h>
30
31
#include <memory>
43
44
 
44
45
static geom::Size const display_size{433,232};
45
46
 
46
 
class AndroidTestFramebufferInit : public ::testing::Test
 
47
class AndroidDisplayTest : public ::testing::Test
47
48
{
48
49
protected:
49
50
    virtual void SetUp()
50
51
    {
51
52
        using namespace testing;
52
 
 
53
 
        native_win = std::make_shared<NiceMock<mtd::MockAndroidFramebufferWindow>>();
54
 
 
55
 
        /* silence uninteresting warning messages */
56
53
        mock_egl.silence_uninteresting();
57
54
 
58
 
        EXPECT_CALL(*native_win, android_native_window_type())
59
 
        .Times(AtLeast(0));
60
 
        EXPECT_CALL(*native_win, android_display_egl_config(_))
61
 
        .Times(AtLeast(0));
62
 
 
 
55
        visual_id = 5;
63
56
        mock_display_report = std::make_shared<NiceMock<mtd::MockDisplayReport>>();
64
 
        stub_display_support = std::make_shared<mtd::StubDisplaySupportProvider>(display_size);
 
57
        stub_display_device = std::make_shared<mtd::StubDisplayDevice>(display_size);
 
58
        auto stub_driver_interpreter = std::make_shared<mtd::StubDriverInterpreter>(display_size, visual_id);
 
59
        native_win = std::make_shared<mg::android::MirNativeWindow>(stub_driver_interpreter);
65
60
        db_factory = std::make_shared<mga::DisplayBufferFactory>();
66
61
    }
67
62
 
 
63
    int visual_id;
68
64
    std::shared_ptr<mga::DisplayBufferFactory> db_factory;
69
65
    std::shared_ptr<mtd::MockDisplayReport> mock_display_report;
70
 
    std::shared_ptr<mtd::MockAndroidFramebufferWindow> native_win;
71
 
    std::shared_ptr<mtd::StubDisplaySupportProvider> stub_display_support;
 
66
    std::shared_ptr<ANativeWindow> native_win;
 
67
    std::shared_ptr<mtd::StubDisplayDevice> stub_display_device;
72
68
    mtd::MockEGL mock_egl;
73
69
};
74
70
 
75
 
TEST_F(AndroidTestFramebufferInit, eglGetDisplay)
 
71
TEST_F(AndroidDisplayTest, eglChooseConfig_attributes)
 
72
{
 
73
    using namespace testing;
 
74
 
 
75
    const EGLint *attr;
 
76
 
 
77
    EXPECT_CALL(mock_egl, eglChooseConfig(mock_egl.fake_egl_display, _, _, _, _))
 
78
        .Times(AtLeast(0))
 
79
        .WillOnce(DoAll(
 
80
            SaveArg<1>(&attr),
 
81
            SetArgPointee<2>(mock_egl.fake_configs),
 
82
            SetArgPointee<4>(mock_egl.fake_configs_num),
 
83
            Return(EGL_TRUE)));
 
84
 
 
85
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report);
 
86
 
 
87
    int i=0;
 
88
    bool surface_bit_correct = false;
 
89
    bool renderable_bit_correct = false;
 
90
    while(attr[i] != EGL_NONE)
 
91
    {
 
92
        if ((attr[i] == EGL_SURFACE_TYPE) && (attr[i+1] == EGL_WINDOW_BIT))
 
93
        {
 
94
            surface_bit_correct = true;
 
95
        }
 
96
        if ((attr[i] == EGL_RENDERABLE_TYPE) && (attr[i+1] == EGL_OPENGL_ES2_BIT))
 
97
        {
 
98
            renderable_bit_correct = true;
 
99
        }
 
100
        i++;
 
101
    };
 
102
 
 
103
    EXPECT_EQ(EGL_NONE, attr[i]);
 
104
    EXPECT_TRUE(surface_bit_correct);
 
105
    EXPECT_TRUE(renderable_bit_correct);
 
106
}
 
107
 
 
108
TEST_F(AndroidDisplayTest, queries_with_enough_room_for_all_potential_cfg)
 
109
{
 
110
    using namespace testing;
 
111
 
 
112
    int num_cfg = 43;
 
113
    const EGLint *attr;
 
114
 
 
115
    EXPECT_CALL(mock_egl, eglGetConfigs(mock_egl.fake_egl_display, NULL, 0, _))
 
116
    .Times(AtLeast(1))
 
117
    .WillOnce(DoAll(
 
118
                  SetArgPointee<3>(num_cfg),
 
119
                  Return(EGL_TRUE)));
 
120
 
 
121
    EXPECT_CALL(mock_egl, eglChooseConfig(mock_egl.fake_egl_display, _, _, num_cfg, _))
 
122
    .Times(AtLeast(1))
 
123
    .WillOnce(DoAll(
 
124
                  SaveArg<1>(&attr),
 
125
                  SetArgPointee<2>(mock_egl.fake_configs),
 
126
                  SetArgPointee<4>(mock_egl.fake_configs_num),
 
127
                  Return(EGL_TRUE)));
 
128
 
 
129
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report);
 
130
 
 
131
    /* should be able to ref this spot */
 
132
    EGLint test_last_spot = attr[num_cfg-1];
 
133
    EXPECT_EQ(test_last_spot, test_last_spot);
 
134
 
 
135
}
 
136
 
 
137
TEST_F(AndroidDisplayTest, creates_with_proper_visual_id_mixed_valid_invalid)
 
138
{
 
139
    using namespace testing;
 
140
 
 
141
    EGLConfig cfg, chosen_cfg;
 
142
 
 
143
    int bad_id = visual_id + 1;
 
144
 
 
145
    EXPECT_CALL(mock_egl, eglGetConfigAttrib(mock_egl.fake_egl_display, _, EGL_NATIVE_VISUAL_ID, _))
 
146
        .Times(AtLeast(1))
 
147
        .WillOnce(DoAll(
 
148
            SetArgPointee<3>(bad_id),
 
149
            Return(EGL_TRUE)))
 
150
        .WillOnce(DoAll(
 
151
            SetArgPointee<3>(visual_id),
 
152
            SaveArg<1>(&cfg),
 
153
            Return(EGL_TRUE)))
 
154
        .WillRepeatedly(DoAll(
 
155
            SetArgPointee<3>(bad_id),
 
156
            Return(EGL_TRUE)));
 
157
 
 
158
    EXPECT_CALL(mock_egl, eglCreateContext(_,_,_,_))
 
159
        .WillRepeatedly(DoAll(
 
160
            SaveArg<1>(&chosen_cfg),
 
161
            Return(mock_egl.fake_egl_context)));
 
162
 
 
163
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report);
 
164
 
 
165
    Mock::VerifyAndClearExpectations(&mock_egl);
 
166
    EXPECT_EQ(cfg, chosen_cfg);
 
167
}
 
168
 
 
169
TEST_F(AndroidDisplayTest, without_proper_visual_id_throws)
 
170
{
 
171
    using namespace testing;
 
172
    int bad_id = visual_id + 1;
 
173
    EXPECT_CALL(mock_egl, eglGetConfigAttrib(mock_egl.fake_egl_display, _, EGL_NATIVE_VISUAL_ID, _))
 
174
        .WillRepeatedly(DoAll(
 
175
            SetArgPointee<3>(bad_id),
 
176
            Return(EGL_TRUE)));
 
177
 
 
178
    EXPECT_THROW(
 
179
    {
 
180
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report);
 
181
    }, std::runtime_error );
 
182
}
 
183
 
 
184
TEST_F(AndroidDisplayTest, eglGetDisplay)
76
185
{
77
186
    using namespace testing;
78
187
 
79
188
    EXPECT_CALL(mock_egl, eglGetDisplay(EGL_DEFAULT_DISPLAY))
80
189
        .Times(1);
81
190
 
82
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
191
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
83
192
}
84
193
 
85
 
TEST_F(AndroidTestFramebufferInit, eglGetDisplay_failure)
 
194
TEST_F(AndroidDisplayTest, eglGetDisplay_failure)
86
195
{
87
196
    using namespace testing;
88
197
 
91
200
        .WillOnce(Return((EGLDisplay)EGL_NO_DISPLAY));
92
201
 
93
202
    EXPECT_THROW({
94
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
203
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
95
204
    }, std::runtime_error   );
96
205
}
97
206
 
98
 
TEST_F(AndroidTestFramebufferInit, eglInitialize)
 
207
TEST_F(AndroidDisplayTest, eglInitialize)
99
208
{
100
209
    using namespace testing;
101
210
 
102
211
    EXPECT_CALL(mock_egl, eglInitialize(mock_egl.fake_egl_display, _, _))
103
212
        .Times(1);
104
213
 
105
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
214
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
106
215
}
107
216
 
108
 
TEST_F(AndroidTestFramebufferInit, eglInitialize_failure)
 
217
TEST_F(AndroidDisplayTest, eglInitialize_failure)
109
218
{
110
219
    using namespace testing;
111
220
 
115
224
 
116
225
    EXPECT_THROW(
117
226
    {
118
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
227
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
119
228
    }, std::runtime_error   );
120
229
}
121
230
 
122
 
TEST_F(AndroidTestFramebufferInit, eglInitialize_failure_bad_major_version)
 
231
TEST_F(AndroidDisplayTest, eglInitialize_failure_bad_major_version)
123
232
{
124
233
    using namespace testing;
125
234
 
131
240
 
132
241
    EXPECT_THROW(
133
242
    {
134
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
243
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
135
244
    }, std::runtime_error   );
136
245
}
137
246
 
138
 
TEST_F(AndroidTestFramebufferInit, eglInitialize_failure_bad_minor_version)
 
247
TEST_F(AndroidDisplayTest, eglInitialize_failure_bad_minor_version)
139
248
{
140
249
    using namespace testing;
141
250
 
147
256
 
148
257
    EXPECT_THROW(
149
258
    {
150
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
259
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
151
260
    }, std::runtime_error   );
152
261
}
153
262
 
154
 
TEST_F(AndroidTestFramebufferInit, eglCreateWindowSurface_requests_config)
155
 
{
156
 
    using namespace testing;
157
 
    EGLConfig fake_config = (EGLConfig) 0x3432;
158
 
    EXPECT_CALL(*native_win, android_display_egl_config(_))
159
 
        .Times(AtLeast(1))
160
 
        .WillRepeatedly(Return(fake_config));
161
 
    EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display, fake_config, _, _))
162
 
        .Times(1);
163
 
 
164
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
165
 
}
166
 
 
167
 
TEST_F(AndroidTestFramebufferInit, eglCreateWindowSurface_nullarg)
 
263
TEST_F(AndroidDisplayTest, eglCreateWindowSurface_nullarg)
168
264
{
169
265
    using namespace testing;
170
266
 
171
267
    EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display, _, _, NULL))
172
268
        .Times(1);
173
269
 
174
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
270
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
175
271
}
176
272
 
177
 
TEST_F(AndroidTestFramebufferInit, eglCreateWindowSurface_uses_native_window_type)
 
273
TEST_F(AndroidDisplayTest, eglCreateWindowSurface_uses_native_window_type)
178
274
{
179
275
    using namespace testing;
180
 
    EGLNativeWindowType egl_window = (EGLNativeWindowType)0x4443;
181
 
 
182
 
    EXPECT_CALL(*native_win, android_native_window_type())
183
 
        .Times(1)
184
 
        .WillOnce(Return(egl_window));
185
 
    EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display, _, egl_window,_))
 
276
    EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display, _, native_win.get(),_))
186
277
        .Times(1);
187
278
 
188
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
279
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
189
280
}
190
281
 
191
 
TEST_F(AndroidTestFramebufferInit, eglCreateWindowSurface_failure)
 
282
TEST_F(AndroidDisplayTest, eglCreateWindowSurface_failure)
192
283
{
193
284
    using namespace testing;
194
285
    EXPECT_CALL(mock_egl, eglCreateWindowSurface(mock_egl.fake_egl_display,_,_,_))
197
288
 
198
289
    EXPECT_THROW(
199
290
    {
200
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
291
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
201
292
    }, std::runtime_error);
202
293
}
203
294
 
204
295
/* create context stuff */
205
 
TEST_F(AndroidTestFramebufferInit, CreateContext_window_cfg_matches_context_cfg)
 
296
TEST_F(AndroidDisplayTest, CreateContext_window_cfg_matches_context_cfg)
206
297
{
207
298
    using namespace testing;
208
299
 
219
310
              SaveArg<1>(&cfg),
220
311
              Return((EGLContext)mock_egl.fake_egl_context)));
221
312
 
222
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
313
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
223
314
 
224
315
    EXPECT_EQ(chosen_cfg, cfg);
225
316
}
226
317
 
227
 
TEST_F(AndroidTestFramebufferInit, CreateContext_contexts_are_shared)
 
318
TEST_F(AndroidDisplayTest, CreateContext_contexts_are_shared)
228
319
{
229
320
    using namespace testing;
230
321
 
237
328
    EXPECT_CALL(mock_egl, eglCreateContext(mock_egl.fake_egl_display, _, shared_ctx,_))
238
329
        .Times(1);
239
330
 
240
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
331
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
241
332
}
242
333
 
243
334
namespace
250
341
 
251
342
}
252
343
 
253
 
TEST_F(AndroidTestFramebufferInit, CreateContext_context_attr_null_terminated)
 
344
TEST_F(AndroidDisplayTest, CreateContext_context_attr_null_terminated)
254
345
{
255
346
    using namespace testing;
256
347
 
262
353
            AppendContextAttrPtr(&context_attr_ptrs),
263
354
            Return((EGLContext)mock_egl.fake_egl_context)));
264
355
 
265
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
356
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
266
357
 
267
358
    for (auto context_attr : context_attr_ptrs)
268
359
    {
272
363
    }
273
364
}
274
365
 
275
 
TEST_F(AndroidTestFramebufferInit, CreateContext_context_uses_client_version_2)
 
366
TEST_F(AndroidDisplayTest, CreateContext_context_uses_client_version_2)
276
367
{
277
368
    using namespace testing;
278
369
 
284
375
            DoAll(AppendContextAttrPtr(&context_attr_ptrs),
285
376
            Return((EGLContext)mock_egl.fake_egl_context)));
286
377
 
287
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
378
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
288
379
 
289
380
    for (auto context_attr : context_attr_ptrs)
290
381
    {
306
397
    };
307
398
}
308
399
 
309
 
TEST_F(AndroidTestFramebufferInit, CreateContext_failure)
 
400
TEST_F(AndroidDisplayTest, CreateContext_failure)
310
401
{
311
402
    using namespace testing;
312
403
 
316
407
 
317
408
    EXPECT_THROW(
318
409
    {
319
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
410
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
320
411
    }, std::runtime_error   );
321
412
}
322
413
 
323
 
TEST_F(AndroidTestFramebufferInit, MakeCurrent_uses_correct_pbuffer_surface)
 
414
TEST_F(AndroidDisplayTest, MakeCurrent_uses_correct_pbuffer_surface)
324
415
{
325
416
    using namespace testing;
326
417
    EGLSurface fake_surface = (EGLSurface) 0x715;
331
422
    EXPECT_CALL(mock_egl, eglMakeCurrent(mock_egl.fake_egl_display, fake_surface, fake_surface, _))
332
423
        .Times(1);
333
424
 
334
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
425
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
335
426
}
336
427
 
337
 
TEST_F(AndroidTestFramebufferInit, MakeCurrent_uses_correct_dummy_context)
 
428
TEST_F(AndroidDisplayTest, MakeCurrent_uses_correct_dummy_context)
338
429
{
339
430
    using namespace testing;
340
431
 
347
438
    EXPECT_CALL(mock_egl, eglMakeCurrent(mock_egl.fake_egl_display, _, _, dummy_ctx))
348
439
        .Times(1);
349
440
 
350
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
441
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
351
442
}
352
443
 
353
 
TEST_F(AndroidTestFramebufferInit, eglMakeCurrent_failure_throws)
 
444
TEST_F(AndroidDisplayTest, eglMakeCurrent_failure_throws)
354
445
{
355
446
    using namespace testing;
356
447
 
360
451
 
361
452
    EXPECT_THROW(
362
453
    {
363
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
454
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
364
455
    }, std::runtime_error);
365
456
 
366
457
}
367
458
 
368
 
TEST_F(AndroidTestFramebufferInit, make_current_from_interface_calls_egl)
 
459
TEST_F(AndroidDisplayTest, make_current_from_interface_calls_egl)
369
460
{
370
461
    using namespace testing;
371
462
 
372
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
463
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
373
464
 
374
465
    EXPECT_CALL(mock_egl, eglMakeCurrent(mock_egl.fake_egl_display, _, _, _))
375
466
        .Times(1)
383
474
    Mock::VerifyAndClearExpectations(&mock_egl);
384
475
}
385
476
 
386
 
TEST_F(AndroidTestFramebufferInit, make_current_failure_throws)
 
477
TEST_F(AndroidDisplayTest, make_current_failure_throws)
387
478
{
388
479
    using namespace testing;
389
480
 
390
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
481
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
391
482
 
392
483
    EXPECT_CALL(mock_egl, eglMakeCurrent(mock_egl.fake_egl_display, _, _, _))
393
484
        .Times(1)
437
528
 
438
529
}
439
530
 
440
 
TEST_F(AndroidTestFramebufferInit, eglContext_resources_freed)
 
531
TEST_F(AndroidDisplayTest, eglContext_resources_freed)
441
532
{
442
533
    using namespace testing;
443
534
 
459
550
    ASSERT_TRUE(store.empty());
460
551
 
461
552
    {
462
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
553
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
463
554
        ASSERT_FALSE(store.empty());
464
555
    }
465
556
 
466
557
    ASSERT_TRUE(store.empty());
467
558
}
468
559
 
469
 
TEST_F(AndroidTestFramebufferInit, eglSurface_resources_freed)
 
560
TEST_F(AndroidDisplayTest, eglSurface_resources_freed)
470
561
{
471
562
    using namespace testing;
472
563
 
494
585
    ASSERT_TRUE(store.empty());
495
586
 
496
587
    {
497
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
588
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
498
589
        ASSERT_FALSE(store.empty());
499
590
    }
500
591
 
501
592
    ASSERT_TRUE(store.empty());
502
593
}
503
594
 
504
 
TEST_F(AndroidTestFramebufferInit, display_termination) 
 
595
TEST_F(AndroidDisplayTest, display_termination) 
505
596
{
506
597
    using namespace testing;
507
598
 
510
601
    EXPECT_CALL(mock_egl, eglTerminate(mock_egl.fake_egl_display))
511
602
        .Times(1);
512
603
 
513
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
604
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
514
605
}
515
606
 
516
607
 
517
 
TEST_F(AndroidTestFramebufferInit, startup_logging_ok)
 
608
TEST_F(AndroidDisplayTest, startup_logging_ok)
518
609
{
519
610
    using namespace testing;
520
611
    EXPECT_CALL(*mock_display_report, report_successful_setup_of_native_resources())
529
620
    EXPECT_CALL(mock_egl, eglMakeCurrent(_,_,_,_))
530
621
        .Times(AtLeast(1));
531
622
 
532
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
623
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
533
624
}
534
625
 
535
 
TEST_F(AndroidTestFramebufferInit, startup_logging_error_because_of_surface_creation_failure)
 
626
TEST_F(AndroidDisplayTest, startup_logging_error_because_of_surface_creation_failure)
536
627
{
537
628
    using namespace testing;
538
629
 
548
639
        .WillOnce(Return(EGL_NO_SURFACE));
549
640
 
550
641
    EXPECT_THROW({
551
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
642
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
552
643
    }, std::runtime_error);
553
644
}
554
645
 
555
 
TEST_F(AndroidTestFramebufferInit, startup_logging_error_because_of_makecurrent)
 
646
TEST_F(AndroidDisplayTest, startup_logging_error_because_of_makecurrent)
556
647
{
557
648
    using namespace testing;
558
649
 
568
659
        .WillOnce(Return(EGL_FALSE));
569
660
 
570
661
    EXPECT_THROW({
571
 
        mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
662
        mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
572
663
    }, std::runtime_error);
573
664
}
574
665
 
575
666
//we only have single display and single mode on android for the time being
576
 
TEST_F(AndroidTestFramebufferInit, android_display_configuration_info)
 
667
TEST_F(AndroidDisplayTest, android_display_configuration_info)
577
668
{
578
 
    mga::AndroidDisplay display(native_win, db_factory, stub_display_support, mock_display_report );
 
669
    mga::AndroidDisplay display(native_win, db_factory, stub_display_device, mock_display_report );
579
670
    auto config = display.configuration();
580
671
 
581
672
    std::vector<mg::DisplayConfigurationOutput> configurations;