Flutter Engine
 
Loading...
Searching...
No Matches
mock_gles_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/testing/testing.h" // IWYU pragma: keep
6#include "gtest/gtest.h"
9
10namespace impeller {
11namespace testing {
12
13// This test just checks that the proc table is initialized correctly.
14//
15// If this test doesn't pass, no test that uses the proc table will pass.
16TEST(MockGLES, CanInitialize) {
17 auto mock_gles = MockGLES::Init();
18
19 std::string_view vendor(reinterpret_cast<const char*>(
20 mock_gles->GetProcTable().GetString(GL_VENDOR)));
21 EXPECT_EQ(vendor, "MockGLES");
22}
23
24// Tests that if we call a function we have not mocked, it's OK.
25TEST(MockGLES, CanCallUnmockedFunction) {
26 auto mock_gles = MockGLES::Init();
27
28 auto& gl = mock_gles->GetProcTable();
29 gl.DeleteFramebuffers(1, nullptr);
30
31 // Test should still complete.
32 // If we end up mocking DeleteFramebuffers, delete this test.
33}
34
35} // namespace testing
36} // namespace impeller
Provides a mocked version of the |ProcTableGLES| class.
Definition mock_gles.h:173
static std::shared_ptr< MockGLES > Init(std::unique_ptr< MockGLESImpl > impl, const std::optional< std::vector< const char * > > &extensions=std::nullopt)
Definition mock_gles.cc:260
TEST(FrameTimingsRecorderTest, RecordVsync)