Flutter Impeller
command_queue_vk_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 <algorithm>
6 
7 #include "flutter/testing/testing.h"
8 #include "gtest/gtest.h"
11 #include "impeller/renderer/backend/vulkan/test/mock_vulkan.h"
12 
13 namespace impeller {
14 namespace testing {
15 
16 TEST(CommandQueueVKTest, QueueSubmit) {
17  const auto context = MockVulkanContextBuilder().Build();
18  auto buffer = context->CreateCommandBuffer();
19  auto status = context->GetCommandQueue()->Submit({buffer});
20  EXPECT_TRUE(status.ok());
21 
22  const auto called = GetMockVulkanFunctions(context->GetDevice());
23  EXPECT_NE(std::find(called->begin(), called->end(), "vkQueueSubmit"),
24  called->end());
25 }
26 
27 TEST(CommandQueueVKTest, SubmitAfterFenceWaiterTerminated) {
28  const auto context = MockVulkanContextBuilder().Build();
29  auto buffer = context->CreateCommandBuffer();
30  context->GetFenceWaiter()->Terminate();
31  auto status = context->GetCommandQueue()->Submit({buffer});
32  EXPECT_EQ(status.code(), fml::StatusCode::kCancelled);
33 
34  // The command buffer should not be submitted to the Vulkan queue if the
35  // fence waiter has been terminated.
36  const auto called = GetMockVulkanFunctions(context->GetDevice());
37  EXPECT_EQ(std::find(called->begin(), called->end(), "vkQueueSubmit"),
38  called->end());
39 }
40 
41 } // namespace testing
42 } // namespace impeller
TEST(AllocationSizeTest, CanCreateTypedAllocations)
std::shared_ptr< ContextGLES > context