Skip to content

Commit

Permalink
Introduce mock_engine for unittest
Browse files Browse the repository at this point in the history
* copied from linux port ('/shell/platform/linux/testing/mock_engine.cc')

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
  • Loading branch information
bwikbs committed Jun 30, 2021
1 parent 1b27461 commit 8088228
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 20 deletions.
3 changes: 2 additions & 1 deletion shell/platform/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ source_set("common_cpp") {
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
]

if (!build_tizen_shell || enable_desktop_embeddings) {
if (!build_tizen_shell) {
deps += [ "//flutter/shell/platform/embedder:embedder_as_internal_library" ]
}

Expand Down Expand Up @@ -182,6 +182,7 @@ if (enable_unittests) {
":common_cpp_switches",
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
"//flutter/shell/platform/common/client_wrapper:client_wrapper_library_stubs",
"//flutter/shell/platform/embedder:embedder_as_internal_library",
"//flutter/testing",
]

Expand Down
16 changes: 10 additions & 6 deletions shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ template("embedder_for_profile") {
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
"//third_party/rapidjson",
]
if (enable_desktop_embeddings) {
deps +=
[ "//flutter/shell/platform/embedder:embedder_as_internal_library" ]
}
}
}

Expand Down Expand Up @@ -224,8 +228,11 @@ executable("flutter_tizen_unittests") {
testonly = true
public = _public_headers
sources = _flutter_tizen_source
sources += [ "tizen_renderer_evas_gl.cc" ]
sources += [ "flutter_tizen_engine_test.cc" ]
sources += [
"flutter_tizen_engine_test.cc",
"testing/mock_engine.cc",
"tizen_renderer_evas_gl.cc",
]
libs = _libs_minimum
libs += [
"ecore_evas",
Expand All @@ -244,10 +251,7 @@ executable("flutter_tizen_unittests") {
":tizen_rootstrap_include_dirs",
"//flutter/shell/platform/common:desktop_library_implementation",
]
public_deps = [
":flutter_engine",
"//third_party/googletest:gtest",
]
public_deps = [ "//third_party/googletest:gtest" ]
deps = [
":flutter_tizen_fixtures",
"//flutter/runtime:libdart",
Expand Down
13 changes: 0 additions & 13 deletions shell/platform/tizen/flutter_tizen_engine_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,26 @@ class FlutterTizenEngineTest : public testing::Test {
TEST_F(FlutterTizenEngineTest, Run) {
EXPECT_TRUE(engine_ != nullptr);
EXPECT_TRUE(engine_->RunEngine(engine_prop));
// TODO : FIXME
std::this_thread::sleep_for(1s);
EXPECT_TRUE(true);
}

// TODO
TEST_F(FlutterTizenEngineTest, DISABLED_Run_Twice) {
EXPECT_TRUE(engine_ != nullptr);
EXPECT_TRUE(engine_->RunEngine(engine_prop));
// TODO : FIXME
std::this_thread::sleep_for(1s);

EXPECT_FALSE(engine_->RunEngine(engine_prop));
std::this_thread::sleep_for(1s);

EXPECT_TRUE(true);
}

TEST_F(FlutterTizenEngineTest, Stop) {
EXPECT_TRUE(engine_ != nullptr);
EXPECT_TRUE(engine_->RunEngine(engine_prop));
// TODO : FIXME
std::this_thread::sleep_for(1s);

EXPECT_TRUE(engine_->StopEngine());
}

TEST_F(FlutterTizenEngineTest, Stop_Twice) {
EXPECT_TRUE(engine_ != nullptr);
EXPECT_TRUE(engine_->RunEngine(engine_prop));
// TODO : FIXME
std::this_thread::sleep_for(1s);

EXPECT_TRUE(engine_->StopEngine());
EXPECT_FALSE(engine_->StopEngine());
}
Expand Down
Loading

0 comments on commit 8088228

Please sign in to comment.