forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
- Loading branch information
Showing
7 changed files
with
179 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,128 @@ | ||
// Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. | ||
// 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. | ||
|
||
// Included first as it collides with the X11 headers. | ||
#include <unistd.h> | ||
#include <chrono> | ||
#include <thread> | ||
#include "gtest/gtest.h" | ||
|
||
// #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h" | ||
#include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h" | ||
#include "flutter/shell/platform/common/incoming_message_dispatcher.h" | ||
// #include "flutter/shell/platform/embedder/embedder.h" | ||
#include "flutter/shell/platform/tizen/channels/key_event_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/lifecycle_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/localization_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/navigation_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/platform_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/platform_view_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/settings_channel.h" | ||
#include "flutter/shell/platform/tizen/channels/text_input_channel.h" | ||
#include "flutter/shell/platform/tizen/flutter_tizen_texture_registrar.h" | ||
#include "flutter/shell/platform/tizen/key_event_handler.h" | ||
#include "flutter/shell/platform/tizen/public/flutter_tizen.h" | ||
#include "flutter/shell/platform/tizen/tizen_event_loop.h" | ||
#include "flutter/shell/platform/tizen/tizen_renderer.h" | ||
#ifdef TIZEN_RENDERER_EVAS_GL | ||
#include "flutter/shell/platform/tizen/tizen_renderer_evas_gl.h" | ||
#else | ||
#include "flutter/shell/platform/tizen/tizen_renderer_ecore_wl2.h" | ||
#include "flutter/shell/platform/tizen/tizen_vsync_waiter.h" | ||
#endif | ||
#include "flutter/shell/platform/tizen/touch_event_handler.h" | ||
|
||
|
||
TEST(FlutterTizenEngineTest, Test1) { | ||
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h" | ||
|
||
using namespace std::chrono_literals; | ||
|
||
std::string TPK_ROOT_PATH = "/tpkroot"; | ||
std::string LIB_PATH = "/lib"; | ||
std::string RES_PATH = "/res"; | ||
|
||
TEST(FlutterTizenEngineTestSimple, Create_Headless) { | ||
flutter::FlutterTizenEngine* tizen_engine = | ||
new flutter::FlutterTizenEngine(false); | ||
EXPECT_TRUE(tizen_engine != nullptr); | ||
delete tizen_engine; | ||
} | ||
|
||
// TODO | ||
TEST(FlutterTizenEngineTestSimple, DISABLED_Create_Headed) { | ||
flutter::FlutterTizenEngine* tizen_engine = | ||
new flutter::FlutterTizenEngine(true); | ||
EXPECT_TRUE(tizen_engine != nullptr); | ||
delete tizen_engine; | ||
} | ||
|
||
class FlutterTizenEngineTest : public testing::Test { | ||
public: | ||
FlutterTizenEngineTest() { | ||
std::string tpk_root; | ||
char path[256]; | ||
EXPECT_TRUE(getcwd(path, sizeof(path)) != NULL); | ||
tpk_root = path + TPK_ROOT_PATH; | ||
|
||
assets_path = tpk_root + RES_PATH + "/flutter_assets"; | ||
icu_data_path = tpk_root + RES_PATH + "/icudtl.dat"; | ||
aot_lib_path = tpk_root + LIB_PATH + "/libapp.so"; | ||
|
||
switches.push_back("--disable-observatory"); | ||
// switches.push_back("--verbose-logging"); | ||
// switches.push_back("--enable-dart-profiling"); | ||
// switches.push_back("--enable-checked-mode"); | ||
} | ||
|
||
protected: | ||
void SetUp() { | ||
engine_prop.assets_path = assets_path.c_str(); | ||
engine_prop.icu_data_path = icu_data_path.c_str(); | ||
engine_prop.aot_library_path = aot_lib_path.c_str(); | ||
engine_prop.switches = switches.data(); | ||
engine_prop.switches_count = switches.size(); | ||
|
||
auto engine = std::make_unique<flutter::FlutterTizenEngine>(false); | ||
engine_ = engine.release(); | ||
} | ||
|
||
void TearDown() { | ||
if (engine_) { | ||
delete engine_; | ||
} | ||
engine_ = nullptr; | ||
} | ||
|
||
std::string assets_path; | ||
std::string icu_data_path; | ||
std::string aot_lib_path; | ||
flutter::FlutterTizenEngine* engine_; | ||
FlutterDesktopEngineProperties engine_prop = {}; | ||
std::vector<const char*> switches; | ||
}; | ||
|
||
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); | ||
} | ||
|
||
TEST(FlutterTizenEngineTest, Test2) { | ||
// 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()); | ||
} | ||
|
||
TEST_F(FlutterTizenEngineTest, GetPluginRegistrar) { | ||
EXPECT_TRUE(engine_ != nullptr); | ||
EXPECT_TRUE(engine_->GetPluginRegistrar() != nullptr); | ||
} | ||
|
||
// TODO | ||
TEST_F(FlutterTizenEngineTest, DISABLED_GetTextureRegistrar) { | ||
EXPECT_TRUE(engine_ != nullptr); | ||
EXPECT_TRUE(engine_->GetTextureRegistrar() != nullptr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters