1/*
2    Copyright (C) 2012 Samsung Electronics
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public License
15    along with this library; if not, write to the Free Software Foundation,
16    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19#include "config.h"
20#include "EWKTestBase.h"
21
22#include "EWKTestEnvironment.h"
23#include <EWebKit.h>
24#include <Ecore.h>
25#include <Edje.h>
26
27extern EWKUnitTests::EWKTestEnvironment* environment;
28
29namespace EWKUnitTests {
30
31EWKTestBase::EWKTestBase()
32{
33}
34
35Evas_Object* EWKTestBase::webView()
36{
37    return m_ewkTestView.webView();
38}
39
40void EWKTestBase::SetUp()
41{
42    ASSERT_TRUE(m_ewkTestView.init());
43}
44
45void EWKTestBase::onLoadFinished(void* data, Evas_Object* webView, void* eventInfo)
46{
47    ecore_main_loop_quit();
48}
49
50void EWKTestBase::waitUntilLoadFinished()
51{
52    evas_object_smart_callback_add(webView(), "load,finished", onLoadFinished, 0);
53    ecore_main_loop_begin();
54    evas_object_smart_callback_del(webView(), "load,finished", onLoadFinished);
55}
56
57void EWKTestBase::loadUrl(const char* url)
58{
59    ASSERT_TRUE(ewk_view_uri_set(webView(), url));
60    waitUntilLoadFinished();
61}
62
63}
64