add windows embedding test (flutter/engine#12423)
This commit is contained in:
@@ -90,7 +90,7 @@ task:
|
||||
task:
|
||||
gce_instance:
|
||||
image_project: flutter-cirrus
|
||||
image_name: flutter-engine-windows-server-2016-core
|
||||
image_name: flutter-engine-windows-server-2016
|
||||
zone: us-central1-a
|
||||
platform: windows
|
||||
cpu: 32
|
||||
@@ -109,11 +109,14 @@ task:
|
||||
cd %ENGINE_PATH%/src
|
||||
gclient sync
|
||||
matrix:
|
||||
- name: build_windows_unopt_debug
|
||||
- name: build_and_test_windows_unopt_debug
|
||||
compile_host_script: |
|
||||
cd %ENGINE_PATH%/src
|
||||
python flutter/tools/gn --runtime-mode debug --unoptimized
|
||||
ninja -C out/host_debug_unopt
|
||||
test_host_script: |
|
||||
cd %ENGINE_PATH%/src
|
||||
python flutter/testing/run_tests.py --type=engine --engine-filter=flutter_windows_unittests,client_wrapper_windows_unittests
|
||||
- name: build_windows_opt_debug
|
||||
compile_host_script: |
|
||||
cd %ENGINE_PATH%/src
|
||||
|
||||
@@ -72,7 +72,10 @@ group("flutter") {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
public_deps += [ "$flutter_root/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests" ]
|
||||
public_deps += [
|
||||
"$flutter_root/shell/platform/windows/client_wrapper:client_wrapper_windows_unittests",
|
||||
"$flutter_root/shell/platform/windows:flutter_windows_unittests"
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_win) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# The following powershell script prepares the VM image
|
||||
# flutter-engine-windows-server-2016-core used by Flutter engine's
|
||||
# flutter-engine-windows-server-2016 used by Flutter engine's
|
||||
# build_windows presubmit tests (see .cirrus.yml).
|
||||
#
|
||||
# The exact step of generating the VM image is:
|
||||
|
||||
@@ -1029,6 +1029,7 @@ FILE: ../../../flutter/shell/platform/windows/win32_flutter_window.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/win32_flutter_window.h
|
||||
FILE: ../../../flutter/shell/platform/windows/win32_window.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/win32_window.h
|
||||
FILE: ../../../flutter/shell/platform/windows/win32_window_unittests.cc
|
||||
FILE: ../../../flutter/shell/platform/windows/window_state.h
|
||||
FILE: ../../../flutter/shell/version/version.cc
|
||||
FILE: ../../../flutter/shell/version/version.h
|
||||
|
||||
@@ -63,8 +63,9 @@ executable("client_wrapper_unittests") {
|
||||
":client_wrapper_library_stubs",
|
||||
"$flutter_root/testing",
|
||||
|
||||
# TODO: Consider refactoring flutter_root/testing so that there's a testing
|
||||
# TODO(chunhtai): Consider refactoring flutter_root/testing so that there's a testing
|
||||
# target that doesn't require a Dart runtime to be linked in.
|
||||
# https://github.com/flutter/flutter/issues/41414.
|
||||
"//third_party/dart/runtime:libdart_jit",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -84,8 +84,9 @@ executable("client_wrapper_glfw_unittests") {
|
||||
"$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_library_stubs",
|
||||
"$flutter_root/testing",
|
||||
|
||||
# TODO: Consider refactoring flutter_root/testing so that there's a testing
|
||||
# TODO(chunhtai): Consider refactoring flutter_root/testing so that there's a testing
|
||||
# target that doesn't require a Dart runtime to be linked in.
|
||||
# https://github.com/flutter/flutter/issues/41414.
|
||||
"//third_party/dart/runtime:libdart_jit",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
assert(is_win)
|
||||
|
||||
import("$flutter_root/shell/platform/glfw/config.gni")
|
||||
import("$flutter_root/testing/testing.gni")
|
||||
|
||||
_public_headers = [ "public/flutter_windows.h" ]
|
||||
|
||||
@@ -100,6 +101,34 @@ shared_library("flutter_windows") {
|
||||
public_configs = [ "$flutter_root:config" ]
|
||||
}
|
||||
|
||||
test_fixtures("flutter_windows_fixtures") {
|
||||
fixtures = []
|
||||
}
|
||||
|
||||
executable("flutter_windows_unittests") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"win32_window_unittests.cc",
|
||||
"testing/win32_flutter_window_test.h",
|
||||
"testing/win32_flutter_window_test.cc",
|
||||
]
|
||||
|
||||
public_configs = [ "$flutter_root:config" ]
|
||||
|
||||
deps = [
|
||||
":flutter_windows_source",
|
||||
":flutter_windows_headers",
|
||||
"//third_party/rapidjson",
|
||||
":flutter_windows_fixtures",
|
||||
"$flutter_root/testing",
|
||||
# TODO(chunhtai): Consider refactoring flutter_root/testing so that there's a testing
|
||||
# target that doesn't require a Dart runtime to be linked in.
|
||||
# https://github.com/flutter/flutter/issues/41414.
|
||||
"//third_party/dart/runtime:libdart_jit",
|
||||
]
|
||||
}
|
||||
|
||||
shared_library("flutter_windows_glfw") {
|
||||
deps = [
|
||||
"$flutter_root/shell/platform/glfw:flutter_glfw",
|
||||
|
||||
@@ -78,8 +78,9 @@ executable("client_wrapper_windows_unittests") {
|
||||
"$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_library_stubs",
|
||||
"$flutter_root/testing",
|
||||
|
||||
# TODO: Consider refactoring flutter_root/testing so that there's a testing
|
||||
# TODO(chunhtai): Consider refactoring flutter_root/testing so that there's a testing
|
||||
# target that doesn't require a Dart runtime to be linked in.
|
||||
# https://github.com/flutter/flutter/issues/41414.
|
||||
"//third_party/dart/runtime:libdart_jit",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "flutter/shell/platform/windows/testing/win32_flutter_window_test.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
Win32FlutterWindowTest::Win32FlutterWindowTest(int width, int height)
|
||||
: Win32FlutterWindow(width, height){};
|
||||
|
||||
Win32FlutterWindowTest::~Win32FlutterWindowTest() = default;
|
||||
|
||||
void Win32FlutterWindowTest::OnFontChange() {
|
||||
on_font_change_called_ = true;
|
||||
}
|
||||
|
||||
bool Win32FlutterWindowTest::OnFontChangeWasCalled() {
|
||||
return on_font_change_called_;
|
||||
}
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/shell/platform/windows/win32_flutter_window.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class Win32FlutterWindowTest : public Win32FlutterWindow {
|
||||
public:
|
||||
Win32FlutterWindowTest(int width, int height);
|
||||
|
||||
~Win32FlutterWindowTest();
|
||||
|
||||
// |Win32Window|
|
||||
void OnFontChange() override;
|
||||
|
||||
bool OnFontChangeWasCalled();
|
||||
|
||||
private:
|
||||
bool on_font_change_called_ = false;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Win32FlutterWindowTest);
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "flutter/shell/platform/windows/testing/win32_flutter_window_test.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
TEST(Win32FlutterWindowTest, CreateDestroy) {
|
||||
Win32FlutterWindowTest window(800, 600);
|
||||
ASSERT_TRUE(TRUE);
|
||||
}
|
||||
|
||||
TEST(Win32FlutterWindowTest, CanFontChange) {
|
||||
Win32FlutterWindowTest window(800, 600);
|
||||
HWND hwnd = window.GetWindowHandle();
|
||||
LRESULT result = SendMessage(hwnd, WM_FONTCHANGE, NULL, NULL);
|
||||
ASSERT_EQ(result, 0);
|
||||
ASSERT_TRUE(window.OnFontChangeWasCalled());
|
||||
ASSERT_TRUE(TRUE);
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
@@ -83,6 +83,10 @@ def RunCCTests(build_dir, filter):
|
||||
# https://github.com/flutter/flutter/issues/36294
|
||||
if not IsWindows():
|
||||
RunEngineExecutable(build_dir, 'embedder_unittests', filter, shuffle_flags)
|
||||
else:
|
||||
RunEngineExecutable(build_dir, 'flutter_windows_unittests', filter, shuffle_flags)
|
||||
|
||||
RunEngineExecutable(build_dir, 'client_wrapper_windows_unittests', filter, shuffle_flags)
|
||||
|
||||
flow_flags = ['--gtest_filter=-PerformanceOverlayLayer.Gold']
|
||||
if IsLinux():
|
||||
|
||||
Reference in New Issue
Block a user