Flutter Engine
The Flutter Engine
gpu_tracer_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#ifdef IMPELLER_DEBUG
14TEST(GPUTracerGLES, CanFormatFramebufferErrorMessage) {
15 auto const extensions = std::vector<const unsigned char*>{
16 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
17 reinterpret_cast<const unsigned char*>("GL_EXT_disjoint_timer_query"), //
18 };
19 auto mock_gles = MockGLES::Init(extensions);
20 auto tracer =
21 std::make_shared<GPUTracerGLES>(mock_gles->GetProcTable(), true);
22 tracer->RecordRasterThread();
23 tracer->MarkFrameStart(mock_gles->GetProcTable());
24 tracer->MarkFrameEnd(mock_gles->GetProcTable());
25
26 auto calls = mock_gles->GetCapturedCalls();
27
28 std::vector<std::string> expected = {"glGenQueriesEXT", "glBeginQueryEXT",
29 "glEndQueryEXT"};
30 for (auto i = 0; i < 3; i++) {
31 EXPECT_EQ(calls[i], expected[i]);
32 }
33
34 // Begin second frame, which prompts the tracer to query the result
35 // from the previous frame.
36 tracer->MarkFrameStart(mock_gles->GetProcTable());
37
38 calls = mock_gles->GetCapturedCalls();
39 std::vector<std::string> expected_b = {"glGetQueryObjectuivEXT",
40 "glGetQueryObjectui64vEXT",
41 "glDeleteQueriesEXT"};
42 for (auto i = 0; i < 3; i++) {
43 EXPECT_EQ(calls[i], expected_b[i]);
44 }
45}
46
47#endif // IMPELLER_DEBUG
48
49} // namespace testing
50} // namespace impeller
static std::shared_ptr< MockGLES > Init(const std::optional< std::vector< const unsigned char * > > &extensions=std::nullopt, const char *version_string="OpenGL ES 3.0", ProcTableGLES::Resolver resolver=kMockResolverGLES)
Returns an initialized |MockGLES| instance.
Definition: mock_gles.cc:166
TEST(AiksCanvasTest, EmptyCullRect)