Eina_Bool ewk_context_tizen_extensible_api_string_set(Ewk_Context* ewkContext, const char* extensibleAPI, Eina_Bool enable)
{
LOG_EWK_API_MOCKUP();
- return NULL;
+ return EINA_FALSE;
}
Eina_Bool ewk_context_tizen_extensible_api_set(Ewk_Context * /*context*/, Ewk_Extensible_API /*extensibleAPI*/, Eina_Bool /*enable*/)
unsigned int ewk_context_inspector_server_start(Ewk_Context* ewkContext, unsigned int port)
{
- LOG_EWK_API_MOCKUP();
- return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
+ return ewkContext->InspectorServerStart(port);
}
Eina_Bool ewk_context_inspector_server_stop(Ewk_Context* ewkContext)
{
- LOG_EWK_API_MOCKUP();
- return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, EINA_FALSE);
+ return ewkContext->InspectorServerStop();
}
void ewk_send_widget_info(Ewk_Context *context,
'utc_blink_ewk_context_form_password_data_delete_all_func.cpp',
'utc_blink_ewk_context_icon_database_icon_object_add_func.cpp',
'utc_blink_ewk_context_icon_database_path_set_func.cpp',
+ 'utc_blink_ewk_context_inspector_server_start_func.cpp',
+ 'utc_blink_ewk_context_inspector_server_stop_func.cpp',
'utc_blink_ewk_context_local_file_system_all_delete_func.cpp',
'utc_blink_ewk_context_local_file_system_delete_func.cpp',
'utc_blink_ewk_context_memory_sampler_start_func.cpp',
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "utc_blink_ewk_base.h"
+
+class utc_blink_ewk_context_inspector_server_start : public utc_blink_ewk_base
+{
+ void LoadFinished(Evas_Object* webview)
+ {
+ EventLoopStop(Success);
+ }
+};
+
+/* @brief Negative test case of ewk_context_inspector_server_start */
+TEST_F(utc_blink_ewk_context_inspector_server_start, NullArg)
+{
+ ASSERT_NE(EINA_TRUE, ewk_context_inspector_server_start(NULL,0));
+}
+
+/* @brief Try start inspector of context on specified TCP port*/
+TEST_F(utc_blink_ewk_context_inspector_server_start, Start)
+{
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
+ ASSERT_NE(Success, EventLoopStart()) << "http://localhost:11111";
+
+ ASSERT_EQ(11111, ewk_context_inspector_server_start(ewk_context_default_get(), 11111));
+ EventLoopWait(1);
+
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
+ ASSERT_EQ(Success, EventLoopStart()) << "http://localhost:11111";
+}
+
+/* @brief Try start inspector of context on unspecified TCP port*/
+TEST_F(utc_blink_ewk_context_inspector_server_start, DefaultPort)
+{
+ int port=ewk_context_inspector_server_start(ewk_context_default_get(), 0);
+ ASSERT_NE(0, port) << "ewk_context_inspector_server_start(0)";
+ EventLoopWait(1);
+
+ char url[32]; sprintf(url, "http://localhost:%u", port);
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), url));
+ ASSERT_EQ(Success, EventLoopStart()) << url;
+
+}
+
+/* @brief Negative test case of ewk_context_inspector_server_start on used port*/
+TEST_F(utc_blink_ewk_context_inspector_server_start, UsedPort)
+{
+ ASSERT_EQ(11111, ewk_view_inspector_server_start(GetEwkWebView(),11111));
+ EventLoopWait(1);
+ ASSERT_NE(11111, ewk_context_inspector_server_start(ewk_context_default_get(),11111));
+}
--- /dev/null
+// Copyright 2014 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "utc_blink_ewk_base.h"
+
+class utc_blink_ewk_context_inspector_server_stop : public utc_blink_ewk_base
+{
+protected:
+ void LoadFinished(Evas_Object* webview)
+ {
+ EventLoopStop(Success);
+ }
+};
+
+/* @brief Try stop inspector with NULL as context */
+TEST_F(utc_blink_ewk_context_inspector_server_stop, NullArg)
+{
+ ASSERT_NE(EINA_TRUE, ewk_context_inspector_server_stop(NULL));
+}
+
+/* @brief Try stop inspector without start */
+TEST_F(utc_blink_ewk_context_inspector_server_stop, WithOutStart)
+{
+ ASSERT_NE(EINA_TRUE, ewk_context_inspector_server_stop(ewk_context_default_get()));
+}
+
+/* @brief Try start inspector after stop */
+TEST_F(utc_blink_ewk_context_inspector_server_stop, StartStop)
+{
+ ASSERT_EQ(11111, ewk_context_inspector_server_start(ewk_context_default_get(), 11111));
+ EventLoopWait(3);
+
+ ASSERT_EQ(EINA_TRUE, ewk_context_inspector_server_stop(ewk_context_default_get()));
+ EventLoopWait(3);
+
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
+ EXPECT_NE(Success, EventLoopStart());
+
+ ASSERT_EQ(11111, ewk_context_inspector_server_start(ewk_context_default_get(), 11111));
+ EventLoopWait(3);
+
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://localhost:11111"));
+ EXPECT_EQ(Success, EventLoopStart());
+}
EWebContext::EWebContext(bool incognito)
: m_pixmap(0),
+ inspector_server_(NULL),
incognito_(incognito) {
CHECK(EwkGlobalData::GetInstance());
#endif
}
+unsigned int EWebContext::InspectorServerStart(unsigned int port) {
+ InspectorServerStop();
+ inspector_server_ = new content::DevToolsDelegateEfl(port);
+ return inspector_server_ ? inspector_server_->port() : 0;
+}
+
+bool EWebContext::InspectorServerStop() {
+ if (!inspector_server_)
+ return false;
+ // The call below destroys inspector_server_.
+ inspector_server_->Stop();
+ inspector_server_ = NULL;
+ return true;
+}
#include "browser/renderer_host/web_cache_manager_efl.h"
#include "tizen_webview/public/tw_cache_model.h"
#include "tizen_webview/public/tw_callbacks.h"
+#include "devtools_delegate_efl.h"
namespace tizen_webview {
class URL;
FaviconDatabase* GetFaviconDatabase();
#endif
+ unsigned int InspectorServerStart(unsigned int port);
+ bool InspectorServerStop();
+
private:
EWebContext(bool incognito);
~EWebContext();
std::string proxy_uri_;
scoped_ptr<EwkDidStartDownloadCallback> start_download_callback_;
int m_pixmap;
+ content::DevToolsDelegateEfl* inspector_server_;
bool incognito_;
};
impl->StopMemorySampler();
}
+unsigned int WebContext::InspectorServerStart(unsigned int port) const {
+ return impl->InspectorServerStart(port);
+}
+
+bool WebContext::InspectorServerStop() const {
+ return impl->InspectorServerStop();
+}
+
} // namespace tizen_webview
FaviconDatabase* GetFaviconDatabase();
#endif
+ unsigned int InspectorServerStart(unsigned int port) const;
+ bool InspectorServerStop() const;
+
private:
EWebContext* impl;