Flutter Engine
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 namespace flutter {
13 namespace testing {
14 
15 EmbedderTest::EmbedderTest() = default;
16 
18  return GetFixturesPath();
19 }
20 
22  // Setup the embedder context lazily instead of in the constructor because we
23  // don't to do all the work if the test won't end up using context.
24  if (!embedder_contexts_[type]) {
25  switch (type) {
27  embedder_contexts_[type] =
28  std::make_unique<EmbedderTestContextSoftware>(
30  break;
31 #ifdef SHELL_ENABLE_GL
33  embedder_contexts_[type] =
34  std::make_unique<EmbedderTestContextGL>(GetFixturesDirectory());
35  break;
36 #endif
37  default:
38  FML_DCHECK(false) << "Invalid context type specified.";
39  break;
40  }
41  }
42 
43  return *embedder_contexts_[type];
44 }
45 
46 } // namespace testing
47 } // namespace flutter
std::string GetFixturesDirectory() const
#define FML_DCHECK(condition)
Definition: logging.h:86
EmbedderTestContext & GetEmbedderContext(ContextType type)
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...