Skip to content

Commit

Permalink
Add a unittest stub for the embedder. (flutter#4276)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored Oct 25, 2017
1 parent 65e4deb commit 144dea3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 5 deletions.
5 changes: 4 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 17 additions & 2 deletions shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
@@ -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);
}
4 changes: 2 additions & 2 deletions travis/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,8 @@ FILE: ../../../flutter/shell/platform/darwin/desktop/flutter_mac.xib
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Flutter.podspec
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Info.plist
FILE: ../../../flutter/shell/platform/darwin/ios/framework/module.modulemap
FILE: ../../../flutter/shell/platform/embedder/EmbedderInfo.plist
FILE: ../../../flutter/shell/platform/embedder/embedder.modulemap
FILE: ../../../flutter/shell/platform/embedder/assets/EmbedderInfo.plist
FILE: ../../../flutter/shell/platform/embedder/assets/embedder.modulemap
FILE: ../../../flutter/sky/engine/core/editing/CompositionUnderlineRangeFilter.cpp
FILE: ../../../flutter/sky/engine/core/editing/CompositionUnderlineRangeFilter.h
FILE: ../../../flutter/sky/engine/core/editing/PositionWithAffinity.cpp
Expand Down

0 comments on commit 144dea3

Please sign in to comment.