Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_test.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/shell/platform/embedder/tests/embedder_test.h"
6#include "flutter/shell/platform/embedder/tests/embedder_test_context_software.h"
7
8#ifdef SHELL_ENABLE_GL
9#include "flutter/shell/platform/embedder/tests/embedder_test_context_gl.h"
10#endif
11
12#ifdef SHELL_ENABLE_METAL
13#include "flutter/shell/platform/embedder/tests/embedder_test_context_metal.h"
14#endif
15
16#ifdef SHELL_ENABLE_VULKAN
17#include "flutter/shell/platform/embedder/tests/embedder_test_context_vulkan.h"
18#endif
19
20namespace flutter {
21namespace testing {
22
24
26 return GetFixturesPath();
27}
28
31 // Setup the embedder context lazily instead of in the constructor because we
32 // don't to do all the work if the test won't end up using context.
33 if (!embedder_contexts_[type]) {
34 switch (type) {
36 embedder_contexts_[type] =
37 std::make_unique<EmbedderTestContextSoftware>(
39 break;
40#ifdef SHELL_ENABLE_VULKAN
42 embedder_contexts_[type] =
43 std::make_unique<EmbedderTestContextVulkan>(GetFixturesDirectory());
44 break;
45#endif
46#ifdef SHELL_ENABLE_GL
48 embedder_contexts_[type] =
49 std::make_unique<EmbedderTestContextGL>(GetFixturesDirectory());
50 break;
51#endif
52#ifdef SHELL_ENABLE_METAL
54 embedder_contexts_[type] =
55 std::make_unique<EmbedderTestContextMetal>(GetFixturesDirectory());
56 break;
57#endif
58 default:
59 FML_DCHECK(false) << "Invalid context type specified.";
60 break;
61 }
62 }
63
64 return *embedder_contexts_[type];
65}
66
67} // namespace testing
68} // namespace flutter
EmbedderTestContext & GetEmbedderContext(EmbedderTestContextType type)
std::string GetFixturesDirectory() const
#define FML_DCHECK(condition)
Definition logging.h:103
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...