From 2fb1e438b193f3ff0a66476bd370e2dab194c24f Mon Sep 17 00:00:00 2001 From: Mateusz Bieganski Date: Wed, 29 Nov 2023 14:54:28 +0100 Subject: [PATCH] uBrowser: Add '-i' switch, to execute WebInspector server on startup. The rationale is to automate performance or correctness tests, with host-side client connecting to WebInspector server and investigating HTML that was rendered. Change-Id: Ib88942b71210f444e44dc257c7dae4df9eaedad1 Signed-off-by: Mateusz Bieganski --- tizen_src/ewk/ubrowser/main.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tizen_src/ewk/ubrowser/main.cc b/tizen_src/ewk/ubrowser/main.cc index 57bf57f..f26eb3c 100644 --- a/tizen_src/ewk/ubrowser/main.cc +++ b/tizen_src/ewk/ubrowser/main.cc @@ -56,6 +56,7 @@ struct AppData { std::vector urls; Browser* browser; + bool browser_autostart_webinspector; bool ewk_initialized; }; @@ -76,6 +77,7 @@ void show_help_and_exit(const char* app_name) { printf(" 2 - minimal GUI\n"); printf(" 3 - full GUI\n"); printf(" -z, --zoom Set zoom factor using double number\n"); + printf(" -i, --inspector Start browser with WebInspector server, running on port 7777.\n"); printf(" -h, --help Show this help message\n"); printf(" -t, --tizen Run WebView with compliance to Tizen version,\n"); printf(" for example, -t 2.4 or -t 2.3.1 etc.\n"); @@ -124,6 +126,7 @@ void parse_options(int argc, char** argv, AppData* data) { {"zoom", required_argument, 0, 'z'}, {"help", no_argument, &show_help, 1}, {"tizen-version", required_argument, 0, 't'}, + {"inspector", no_argument, 0, 'i'}, #if defined(TIZEN_VIDEO_HOLE) {"overlay", no_argument, &video_hw_overlay, 1}, #endif @@ -134,9 +137,9 @@ void parse_options(int argc, char** argv, AppData* data) { int option_index = 0; #if defined(TIZEN_VIDEO_HOLE) - c = getopt_long(argc, argv, "vndmhou:l:z:t:", long_options, &option_index); + c = getopt_long(argc, argv, "ivndmhou:l:z:t:", long_options, &option_index); #else - c = getopt_long(argc, argv, "vndmhu:l:z:t:", long_options, &option_index); + c = getopt_long(argc, argv, "ivndmhu:l:z:t:", long_options, &option_index); #endif if (c == -1) @@ -172,6 +175,9 @@ void parse_options(int argc, char** argv, AppData* data) { case 't': tizen_version = optarg; break; + case 'i': + data->browser_autostart_webinspector = true; + break; #if defined(TIZEN_VIDEO_HOLE) case 'o': video_hw_overlay = 1; @@ -219,6 +225,8 @@ static bool app_create(void* data) { new Browser(desktop_mode, gui_level, user_agent, tizen_version); if (zoom_factor > 0) app_data->browser->SetDefaultZoomFactor(zoom_factor); + if (app_data->browser_autostart_webinspector) + app_data->browser->StartInspectorServer(); #if defined(TIZEN_VIDEO_HOLE) if (video_hw_overlay) -- 2.7.4