~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-01-08 02:04:38 UTC
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: package-import@ubuntu.com-20140108020438-e1npu0pm7qdv5wc4
Tags: upstream-0.1.3+14.04.20140108
ImportĀ upstreamĀ versionĀ 0.1.3+14.04.20140108

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include "mir/graphics/null_display_report.h"
 
20
#include "mir/graphics/native_platform.h"
20
21
#include "mir/graphics/buffer_ipc_packer.h"
21
22
#include "mir/options/program_option.h"
22
 
#include "src/server/graphics/android/android_platform.h"
 
23
#include "src/platform/graphics/android/android_platform.h"
23
24
#include "mir_test_doubles/mock_buffer.h"
 
25
#include "mir_test_doubles/mock_android_hw.h"
24
26
#include "mir_test_doubles/mock_buffer_packer.h"
25
27
#include "mir_test_doubles/mock_display_report.h"
26
28
#include "mir_test_doubles/stub_display_builder.h"
61
63
        }
62
64
 
63
65
        native_buffer = std::make_shared<mtd::StubAndroidNativeBuffer>();
64
 
        mock_buffer = std::make_shared<mtd::MockBuffer>();
 
66
        mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>();
65
67
 
66
68
        ON_CALL(*native_buffer, handle())
67
69
            .WillByDefault(Return(native_buffer_handle.get()));
93
95
    {
94
96
        EXPECT_CALL(mock_packer, pack_fd(native_buffer_handle->data[offset++]))
95
97
            .Times(1);
96
 
    } 
 
98
    }
97
99
    for(auto i=0u; i<num_ints; i++)
98
100
    {
99
101
        EXPECT_CALL(mock_packer, pack_data(native_buffer_handle->data[offset++]))
121
123
 
122
124
    EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());
123
125
}
 
126
 
 
127
TEST(NestedPlatformCreation, doesnt_access_display_hardware)
 
128
{
 
129
    using namespace testing;
 
130
 
 
131
    mtd::HardwareAccessMock hwaccess;
 
132
    mtd::MockDisplayReport stub_report;
 
133
 
 
134
    EXPECT_CALL(hwaccess, hw_get_module(StrEq(HWC_HARDWARE_MODULE_ID), _))
 
135
        .Times(0);
 
136
    EXPECT_CALL(hwaccess, hw_get_module(StrEq(GRALLOC_HARDWARE_MODULE_ID), _))
 
137
        .Times(AtMost(1));
 
138
 
 
139
    auto platform = mg::create_native_platform(mt::fake_shared(stub_report));
 
140
}