4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
24 #include <gconf/gconf-client.h>
27 static void startup(), cleanup();
28 void (*tet_startup) () = startup;
29 void (*tet_cleanup) () = cleanup;
31 static void utc_location_get_address_01();
32 static void utc_location_get_address_02();
33 static void utc_location_get_address_03();
35 struct tet_testlist tet_testlist[] = {
36 {utc_location_get_address_01,1},
37 {utc_location_get_address_02,2},
38 {utc_location_get_address_03,3},
42 static GMainLoop *loop = NULL;
43 LocationObject* loc = NULL;
44 int ret = LOCATION_ERROR_NONE;
47 #define GCONF_PROXY_MODE "/system/proxy/mode"
48 #define GCONF_HTTP_PROXY_HOST "/system/http_proxy/host"
49 #define GCONF_HTTP_PROXY_PORT "/system/http_proxy/port"
50 #define ENV_HTTP_PROXY "http_proxy"
53 exit_loop (gpointer data)
55 g_main_loop_quit (loop);
60 exit_loop_fail (gpointer data)
62 g_main_loop_quit (loop);
70 loc = location_new(LOCATION_METHOD_GPS);
72 loop = g_main_loop_new(NULL,FALSE);
73 g_main_loop_run (loop);
75 tet_printf("\n TC startup");
82 tet_printf("\n TC End");
86 _get_address (GObject *self,
90 LocationAccuracy *acc = NULL;
91 LocationAddress *addr = NULL;
93 ret = location_get_address(loc, &addr, &acc);
94 tet_printf("Returned value: %d", ret);
95 if (ret == LOCATION_ERROR_NONE ||
96 ret == LOCATION_ERROR_CONFIGURATION) {
97 location_address_free(addr);
98 location_accuracy_free(acc);
100 } else tet_result(TET_FAIL);
101 g_main_loop_quit (loop);
105 utc_location_get_address_01()
107 g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_address), loc);
109 g_timeout_add_seconds(60, exit_loop_fail, NULL);
110 g_main_loop_run (loop);
114 utc_location_get_address_02()
116 LocationAccuracy *acc = NULL;
117 LocationAddress *addr = NULL;
119 ret = location_get_address(NULL, &addr, &acc);
120 tet_printf("Returned value: %d", ret);
121 if (ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
122 else tet_result(TET_FAIL);
126 utc_location_get_address_03()
128 LocationAccuracy *acc = NULL;
129 ret = location_get_address(loc, NULL, &acc);
130 tet_printf("Returned value: %d", ret);
131 if(ret == LOCATION_ERROR_PARAMETER) tet_result(TET_PASS);
132 else tet_result(TET_FAIL);