Add a unittest stub for the embedder. (flutter/engine#4276)

This commit is contained in:
Chinmay Garde
2017-10-25 13:09:59 -07:00
committed by GitHub
parent b605573b1f
commit 8ed91439b5
5 changed files with 36 additions and 3 deletions

View File

@@ -39,7 +39,10 @@ group("flutter") {
]
}
if (!is_win) {
public_deps += [ "$flutter_root/shell/platform/embedder:flutter_engine" ]
public_deps += [
"$flutter_root/shell/platform/embedder:embedder_unittests",
"$flutter_root/shell/platform/embedder:flutter_engine",
]
}
public_deps += [
"$flutter_root/flow:flow_unittests",

View File

@@ -26,6 +26,21 @@ source_set("embedder") {
public_configs = [ "$flutter_root:config" ]
}
executable("embedder_unittests") {
testonly = true
include_dirs = [ "." ]
sources = [
"tests/embedder_unittests.cc",
]
deps = [
":embedder",
"$flutter_root/testing",
]
}
shared_library("flutter_engine") {
deps = [
":embedder",
@@ -73,7 +88,7 @@ if (is_mac) {
copy("copy_info_plist") {
visibility = [ ":*" ]
sources = [
"EmbedderInfo.plist",
"assets/EmbedderInfo.plist",
]
outputs = [
"$_flutter_embedder_framework_dir/Versions/A/Resources/Info.plist",
@@ -83,7 +98,7 @@ if (is_mac) {
copy("copy_module_map") {
visibility = [ ":*" ]
sources = [
"embedder.modulemap",
"assets/embedder.modulemap",
]
outputs = [
"$_flutter_embedder_framework_dir/Versions/A/Modules/module.modulemap",

View File

@@ -0,0 +1,15 @@
// Copyright 2017 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 "embedder.h"
#include "gtest/gtest.h"
TEST(EmbedderTest, MustNotRunWithInvalidArgs) {
FlutterEngine engine = nullptr;
FlutterRendererConfig config = {};
FlutterProjectArgs args = {};
auto result = FlutterEngineRun(FLUTTER_ENGINE_VERSION + 1, &config, &args,
NULL, &engine);
ASSERT_NE(result, kSuccess);
}