Flutter Engine
flutter::testing::EmbedderTest Class Reference

#include <embedder_test.h>

Inheritance diagram for flutter::testing::EmbedderTest:
flutter::testing::ThreadTest

Public Types

enum  ContextType {
  ContextType::kSoftwareContext,
  ContextType::kOpenGLContext
}
 

Public Member Functions

 EmbedderTest ()
 
std::string GetFixturesDirectory () const
 
EmbedderTestContextGetEmbedderContext (ContextType type)
 
- Public Member Functions inherited from flutter::testing::ThreadTest
 ThreadTest ()
 
fml::RefPtr< fml::TaskRunnerGetCurrentTaskRunner ()
 Get the task runner for the thread that the current unit-test is running on. This creates a message loop as necessary. More...
 
fml::RefPtr< fml::TaskRunnerCreateNewThread (std::string name="")
 Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test. The message loop is terminated (and its thread joined) when the test ends. This allows tests to create multiple named threads as necessary. More...
 

Detailed Description

Definition at line 19 of file embedder_test.h.

Member Enumeration Documentation

◆ ContextType

Enumerator
kSoftwareContext 
kOpenGLContext 

Definition at line 21 of file embedder_test.h.

21  {
22  kSoftwareContext,
23  kOpenGLContext,
24  };

Constructor & Destructor Documentation

◆ EmbedderTest()

flutter::testing::EmbedderTest::EmbedderTest ( )
default

Member Function Documentation

◆ GetEmbedderContext()

EmbedderTestContext & flutter::testing::EmbedderTest::GetEmbedderContext ( ContextType  type)

Definition at line 21 of file embedder_test.cc.

References FML_DCHECK, GetFixturesDirectory(), kOpenGLContext, and kSoftwareContext.

21  {
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 }
std::string GetFixturesDirectory() const
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ GetFixturesDirectory()

std::string flutter::testing::EmbedderTest::GetFixturesDirectory ( ) const

Definition at line 17 of file embedder_test.cc.

References flutter::testing::GetFixturesPath().

Referenced by GetEmbedderContext().

17  {
18  return GetFixturesPath();
19 }
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...

The documentation for this class was generated from the following files: