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#include "config.h"
21#include "EWK2UnitTestEnvironment.h"
22
23#include <wtf/text/StringBuilder.h>
24#include <wtf/text/StringConcatenate.h>
25#include <wtf/text/WTFString.h>
26
27namespace EWK2UnitTest {
28
29EWK2UnitTestEnvironment::EWK2UnitTestEnvironment()
30    : m_defaultWidth(800)
31    , m_defaultHeight(600)
32{
33    setenv("WEBKIT_EXEC_PATH", WEBKIT_EXEC_PATH, false);
34}
35
36const char* EWK2UnitTestEnvironment::defaultTestPageUrl() const
37{
38    return "file://" TEST_RESOURCES_DIR "/default_test_page.html";
39}
40
41const char* EWK2UnitTestEnvironment::defaultTheme() const
42{
43    return TEST_THEME_DIR "/default.edj";
44}
45
46const char* EWK2UnitTestEnvironment::injectedBundleSample() const
47{
48    return TEST_LIB_DIR "/libewk2UnitTestInjectedBundleSample.so";
49}
50
51CString EWK2UnitTestEnvironment::urlForResource(const char* resource)
52{
53    return makeString("file://" TEST_RESOURCES_DIR "/", resource).utf8();
54}
55
56CString EWK2UnitTestEnvironment::pathForResource(const char* resource)
57{
58    StringBuilder builder;
59    builder.appendLiteral(TEST_RESOURCES_DIR "/");
60    builder.append(resource);
61    return builder.toString().utf8();
62}
63
64CString EWK2UnitTestEnvironment::pathForTheme(const char* theme)
65{
66    StringBuilder builder;
67    builder.appendLiteral(TEST_THEME_DIR "/");
68    builder.append(theme);
69    return builder.toString().utf8();
70}
71
72} // namespace EWK2UnitTest
73