Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/platform/windows/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ executable("flutter_windows_unittests") {
# "flutter_windows_engine_unittests.cc", //TODO failing to send / receive platform message get plugins working first. Blocked on https://github.com/flutter/flutter/issues/74155
"string_conversion_unittests.cc",
"system_utils_unittests.cc",
"testing/engine_embedder_api_modifier.h",
"testing/engine_modifier.h",
]

# Target-specific sources.
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/windows/flutter_window_win32_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
#include "flutter/shell/platform/windows/keyboard_key_channel_handler.h"
#include "flutter/shell/platform/windows/keyboard_key_handler.h"
#include "flutter/shell/platform/windows/testing/engine_embedder_api_modifier.h"
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
#include "flutter/shell/platform/windows/testing/flutter_window_win32_test.h"
#include "flutter/shell/platform/windows/testing/mock_window_binding_handler.h"
#include "flutter/shell/platform/windows/text_input_plugin.h"
Expand Down Expand Up @@ -247,7 +247,7 @@ std::unique_ptr<FlutterWindowsEngine> GetTestEngine() {
FlutterProjectBundle project(properties);
auto engine = std::make_unique<FlutterWindowsEngine>(project);

EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());
// Force the non-AOT path unless overridden by the test.
modifier.embedder_api().RunsAOTCompiledDartCode = []() { return false; };

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/windows/flutter_windows_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class FlutterWindowsEngine {

private:
// Allows swapping out embedder_api_ calls in tests.
friend class EngineEmbedderApiModifier;
friend class EngineModifier;

// Sends system settings (e.g., locale) to the engine.
//
Expand Down
12 changes: 6 additions & 6 deletions shell/platform/windows/flutter_windows_engine_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/windows/testing/engine_embedder_api_modifier.h"
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
#include "gtest/gtest.h"

namespace flutter {
Expand All @@ -22,7 +22,7 @@ std::unique_ptr<FlutterWindowsEngine> GetTestEngine() {
FlutterProjectBundle project(properties);
auto engine = std::make_unique<FlutterWindowsEngine>(project);

EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());
// Force the non-AOT path unless overridden by the test.
modifier.embedder_api().RunsAOTCompiledDartCode = []() { return false; };

Expand All @@ -32,7 +32,7 @@ std::unique_ptr<FlutterWindowsEngine> GetTestEngine() {

TEST(FlutterWindowsEngine, RunDoesExpectedInitialization) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

// The engine should be run with expected configuration values.
bool run_called = false;
Expand Down Expand Up @@ -103,7 +103,7 @@ TEST(FlutterWindowsEngine, RunDoesExpectedInitialization) {

TEST(FlutterWindowsEngine, RunWithoutANGLEUsesSoftware) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

// The engine should be run with expected configuration values.
bool run_called = false;
Expand Down Expand Up @@ -142,7 +142,7 @@ TEST(FlutterWindowsEngine, RunWithoutANGLEUsesSoftware) {

TEST(FlutterWindowsEngine, SendPlatformMessageWithoutResponse) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

const char* channel = "test";
const std::vector<uint8_t> test_message = {1, 2, 3, 4};
Expand All @@ -168,7 +168,7 @@ TEST(FlutterWindowsEngine, SendPlatformMessageWithoutResponse) {

TEST(FlutterWindowsEngine, SendPlatformMessageWithResponse) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

const char* channel = "test";
const std::vector<uint8_t> test_message = {1, 2, 3, 4};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
#include "flutter/shell/platform/windows/flutter_windows_texture_registrar.h"
#include "flutter/shell/platform/windows/testing/engine_embedder_api_modifier.h"
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
#include "gtest/gtest.h"

namespace flutter {
Expand Down Expand Up @@ -35,7 +35,7 @@ TEST(FlutterWindowsTextureRegistrarTest, CreateDestroy) {

TEST(FlutterWindowsTextureRegistrarTest, RegisterUnregisterTexture) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

FlutterWindowsTextureRegistrar registrar(engine.get());

Expand Down Expand Up @@ -90,7 +90,7 @@ TEST(FlutterWindowsTextureRegistrarTest, RegisterUnregisterTexture) {

TEST(FlutterWindowsTextureRegistrarTest, RegisterUnknownTextureType) {
std::unique_ptr<FlutterWindowsEngine> engine = GetTestEngine();
EngineEmbedderApiModifier modifier(engine.get());
EngineModifier modifier(engine.get());

FlutterWindowsTextureRegistrar registrar(engine.get());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
#include "flutter/shell/platform/windows/testing/engine_embedder_api_modifier.h"
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
#include "gtest/gtest.h"

namespace flutter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ namespace flutter {
// This simply provides a way to access the normally-private embedder proc
// table, so the lifetime of any changes made to the proc table is that of the
// engine object, not this helper.
class EngineEmbedderApiModifier {
class EngineModifier {
public:
explicit EngineEmbedderApiModifier(FlutterWindowsEngine* engine)
: engine_(engine) {}
explicit EngineModifier(FlutterWindowsEngine* engine) : engine_(engine) {}

// Returns the engine's embedder API proc table, allowing for modification.
//
Expand Down