Flutter Engine
 
Loading...
Searching...
No Matches
unique_handle_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"
10
11namespace impeller {
12namespace testing {
13
14using ::testing::_;
15
16namespace {
17class TestWorker : public ReactorGLES::Worker {
18 public:
20 const ReactorGLES& reactor) const override {
21 return true;
22 }
23};
24} // namespace
25
26TEST(UniqueHandleGLES, MakeUntracked) {
27 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
28
29 EXPECT_CALL(*mock_gles_impl, GenTextures(1, _)).Times(1);
30
31 std::shared_ptr<MockGLES> mock_gled =
32 MockGLES::Init(std::move(mock_gles_impl));
34 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
35 auto worker = std::make_shared<TestWorker>();
36 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
37 reactor->AddWorker(worker);
38
39 UniqueHandleGLES handle =
41 EXPECT_FALSE(handle.Get().IsDead());
42}
43
44} // namespace testing
45} // namespace impeller
constexpr bool IsDead() const
Determines if the handle is dead.
Definition handle_gles.h:53
std::function< void *(const char *function_name)> Resolver
A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the a...
static UniqueHandleGLES MakeUntracked(std::shared_ptr< ReactorGLES > reactor, HandleType type)
const HandleGLES & Get() const
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
bool CanReactorReactOnCurrentThreadNow(const ReactorGLES &reactor) const override
Determines the ability of the worker to service a reaction on the current thread. The OpenGL context ...
TEST(FrameTimingsRecorderTest, RecordVsync)
const ProcTableGLES::Resolver kMockResolverGLES
Definition mock_gles.cc:287