Exemplo n.º 1
0
void EWK2UnitTestBase::SetUp()
{
    unsigned int width = environment->defaultWidth();
    unsigned int height = environment->defaultHeight();

#if defined(WTF_USE_ACCELERATED_COMPOSITING) && defined(HAVE_ECORE_X)
    const char* engine = "opengl_x11";
    m_ecoreEvas = ecore_evas_new(engine, 0, 0, width, height, 0);
#else
    m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0);
#endif

    ecore_evas_show(m_ecoreEvas);
    Evas* evas = ecore_evas_get(m_ecoreEvas);

    Evas_Smart* smart = evas_smart_class_new(&m_ewkViewClass.sc);

    Ewk_Context* newContext = ewk_context_new();
    Ewk_Page_Group* newPageGroup = ewk_page_group_create("UnitTest");
    m_webView = ewk_view_smart_add(evas, smart, newContext, newPageGroup);

    // Clear HTTP cache files before running the unit tests, which prevents 
    // performance degradation due to so many cache files.
    ewk_context_resource_cache_clear(newContext);
    ewk_object_unref(newContext);
    ewk_object_unref(newPageGroup);

    ewk_view_theme_set(m_webView, environment->defaultTheme());

    evas_object_resize(m_webView, width, height);
    evas_object_show(m_webView);
    evas_object_focus_set(m_webView, true);
}
Exemplo n.º 2
0
static MiniBrowser *browserCreate(const char *url, const char *engine)
{
    MiniBrowser *app = malloc(sizeof(MiniBrowser));

    app->ee = ecore_evas_new(engine, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0);
    if (!app->ee)
        return 0;

    ecore_evas_title_set(app->ee, APP_NAME);
    ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize);
    ecore_evas_borderless_set(app->ee, 0);
    ecore_evas_show(app->ee);
    ecore_evas_callback_delete_request_set(app->ee, closeWindow);

    app->evas = ecore_evas_get(app->ee);

    app->bg = evas_object_rectangle_add(app->evas);
    evas_object_name_set(app->bg, "bg");
    evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

    evas_object_move(app->bg, 0, 0);
    evas_object_resize(app->bg, DEFAULT_WIDTH, DEFAULT_HEIGHT);
    evas_object_color_set(app->bg, 255, 150, 150, 255);
    evas_object_show(app->bg);

    /* Create webview */
    app->browser = ewk_view_add(app->evas);
    ewk_view_theme_set(app->browser, THEME_DIR"/default.edj");
    evas_object_name_set(app->browser, "browser");

    evas_object_smart_callback_add(app->browser, "load,error", on_error, app);
    evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
    evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
    evas_object_smart_callback_add(app->browser, "uri,changed", on_url_changed, app);

    evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);

    evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_move(app->browser, 0, URL_BAR_HEIGHT);
    evas_object_resize(app->browser, DEFAULT_WIDTH, DEFAULT_HEIGHT - URL_BAR_HEIGHT);
    evas_object_show(app->browser);
    evas_object_focus_set(app->browser, EINA_TRUE);

    app->url_bar = url_bar_add(app->browser, DEFAULT_WIDTH);

    ewk_view_uri_set(app->browser, url);

    return app;
}
Exemplo n.º 3
0
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
{
    ASSERT(m_page);

    m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0);
    if (!m_inspectorWindow)
        return 0;

    m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()));
    ewk_view_theme_set(m_inspectorView, TEST_THEME_DIR"/default.edj");

    Ewk_Settings* settings = ewk_view_settings_get(m_inspectorView);
    ewk_settings_file_access_from_file_urls_allowed_set(settings, true);

    return ewk_view_page_get(m_inspectorView);
}
Exemplo n.º 4
0
Evas_Object *
webview_add(Browser_Data *bd)
{
   Evas_Object *web;

   web = webview_ewk_add(bd->win, bd);

   //FIXME : Check installation path(for release) with build directory(for development)
   ewk_view_theme_set(EWKVIEW(web), THEME_BUILD_PATH "/webkit.edj");

   ewk_context_favicon_database_directory_set(ewk_view_context_get(EWKVIEW(web)), NULL);

   ewk_settings_plugins_enabled_set(ewk_page_group_settings_get(ewk_view_page_group_get(EWKVIEW(web))), EINA_FALSE);

   //webview_user_agent_set(web, MOBILE_USER_AGENT);

   return web;
}
Exemplo n.º 5
0
PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKPageRef /* relatedPage */, WKDictionaryRef options)
    : m_options(options)
{
    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
    m_usingFixedLayout = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false;

    m_window = initEcoreEvas();

    m_view = EWKViewCreate(context, pageGroup, ecore_evas_get(m_window), /* smart */ 0);

    WKPageSetUseFixedLayout(WKViewGetPage(EWKViewGetWKView(m_view)), m_usingFixedLayout);

    if (m_usingFixedLayout)
        resizeTo(800, 600);

    ewk_view_theme_set(m_view, TEST_THEME_DIR "/default.edj");
    m_windowIsKey = false;
    evas_object_show(m_view);
}
Exemplo n.º 6
0
PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const TestOptions& options)
    : m_options(options)
{
    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
    m_usingFixedLayout = options.useFixedLayout;

    m_window = initEcoreEvas();

    WKContextRef context = WKPageConfigurationGetContext(configuration);
    m_view = EWKViewCreate(context, configuration, ecore_evas_get(m_window), /* smart */ 0);

    WKPageSetUseFixedLayout(WKViewGetPage(EWKViewGetWKView(m_view)), m_usingFixedLayout);

    if (m_usingFixedLayout)
        resizeTo(800, 600);

    ewk_view_theme_set(m_view, DEFAULT_THEME_DIR "/default.edj");
    m_windowIsKey = false;
    evas_object_show(m_view);
}
Exemplo n.º 7
0
void EWK2UnitTestBase::SetUp()
{
    ewk_init();

    unsigned int width = environment->defaultWidth();
    unsigned int height = environment->defaultHeight();

    m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0);

    ecore_evas_show(m_ecoreEvas);
    Evas* evas = ecore_evas_get(m_ecoreEvas);

    Evas_Smart* smart = evas_smart_class_new(&m_ewkViewClass.sc);
    m_webView = ewk_view_smart_add(evas, smart, ewk_context_default_get());
    ewk_view_theme_set(m_webView, environment->defaultTheme());

    evas_object_resize(m_webView, width, height);
    evas_object_show(m_webView);
    evas_object_focus_set(m_webView, true);
}
Exemplo n.º 8
0
bool EWKTestView::init()
{
    if (!m_evas || m_url.empty())
        return false;

    switch (m_defaultViewType) {
    case SingleView:
        m_webView = adoptRef(ewk_view_single_add(m_evas));
        break;

    case TiledView:
        m_webView = adoptRef(ewk_view_tiled_add(m_evas));
        break;
    }

    if (!m_webView.get())
        return false;

    ewk_view_theme_set(m_webView.get(), Config::defaultThemePath);
    ewk_view_uri_set(m_webView.get(), m_url.c_str());
}
Exemplo n.º 9
0
void EWK2UnitTestBase::SetUp()
{
    unsigned int width = environment->defaultWidth();
    unsigned int height = environment->defaultHeight();

#if defined(HAVE_ECORE_X)
    const char* engine = "opengl_x11";
    m_ecoreEvas = ecore_evas_new(engine, 0, 0, width, height, 0);
    // Graceful fallback to software rendering if evas_gl engine is not available.
    if (!m_ecoreEvas)
#endif
    m_ecoreEvas = ecore_evas_new(0, 0, 0, width, height, 0);

    ecore_evas_show(m_ecoreEvas);
    Evas* evas = ecore_evas_get(m_ecoreEvas);

    Evas_Smart* smart = evas_smart_class_new(&m_ewkViewClass.sc);

    Ewk_Context* newContext = ewk_context_new();
    if (m_multipleProcesses)
        ewk_context_process_model_set(newContext, EWK_PROCESS_MODEL_MULTIPLE_SECONDARY);

    Ewk_Page_Group* newPageGroup = ewk_page_group_create("UnitTest");
    m_webView = ewk_view_smart_add(evas, smart, newContext, newPageGroup);

    // Clear HTTP cache files before running the unit tests, which prevents 
    // performance degradation due to so many cache files.
    ewk_context_resource_cache_clear(newContext);
    ewk_object_unref(newContext);
    ewk_object_unref(newPageGroup);

    ewk_view_theme_set(m_webView, environment->defaultTheme());

    evas_object_resize(m_webView, width, height);
    evas_object_show(m_webView);
    evas_object_focus_set(m_webView, true);
}