1/* 2 Copyright (C) 2012 Samsung Electronics 3 Copyright (C) 2012 Intel Corporation. All rights reserved. 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public License 16 along with this library; if not, write to the Free Software Foundation, 17 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18*/ 19 20#ifndef EWK2UnitTestBase_h 21#define EWK2UnitTestBase_h 22 23#include "EWK2UnitTestEnvironment.h" 24#include <EWebKit2.h> 25#include <Ecore.h> 26#include <Ecore_Evas.h> 27#include <Eina.h> 28#include <Evas.h> 29#include <gtest/gtest.h> 30 31namespace EWK2UnitTest { 32 33class EWK2UnitTestBase : public ::testing::Test { 34public: 35 Ecore_Evas* backingStore() { return m_ecoreEvas; } 36 Evas* canvas() { return ecore_evas_get(m_ecoreEvas); } 37 Evas_Object* webView() { return m_webView; } 38 void setWebView(Evas_Object* webView) { m_webView = webView; } 39 Ewk_View_Smart_Class* ewkViewClass() { return &m_ewkViewClass; } 40 41protected: 42 EWK2UnitTestBase(); 43 44 virtual void SetUp(); 45 virtual void TearDown(); 46 47 static const double defaultTimeoutSeconds = 10.0; 48 49 bool loadUrlSync(const char* url, double timeoutSeconds = defaultTimeoutSeconds); 50 bool waitUntilLoadFinished(double timeoutSeconds = defaultTimeoutSeconds); 51 bool waitUntilTitleChangedTo(const char* expectedTitle, double timeoutSeconds = defaultTimeoutSeconds); 52 bool waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds = defaultTimeoutSeconds); 53 bool waitUntilTrue(bool &flag, double timeoutSeconds = defaultTimeoutSeconds); 54 55 void mouseClick(int x, int y, int button = 1 /*Left*/); 56 void mouseDown(int x, int y, int button = 1 /*Left*/); 57 void mouseUp(int x, int y, int button = 1 /*Left*/); 58 void mouseMove(int x, int y); 59 void multiDown(int id, int x, int y); 60 void multiUp(int id, int x, int y); 61 void multiMove(int id, int x, int y); 62 63private: 64 Evas_Object* m_webView; 65 Ecore_Evas* m_ecoreEvas; 66 Ewk_View_Smart_Class m_ewkViewClass; 67}; 68 69} // namespace EWK2UnitTest 70 71#endif // EWK2UnitTestBase_h 72