2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file TestCases_GlobalDAO.cpp
18 * @author Pawel Sikorski (p.sikorski@samsung.com)
20 * @brief This file contains tests for global dao class.
26 #include <dpl/test/test_runner.h>
27 #include <dpl/foreach.h>
28 #include <dpl/exception.h>
29 #include <dpl/string.h>
30 #include <dpl/wrt-dao-rw/global_dao.h>
31 #include <dpl/wrt-dao-ro/wrt_db_types.h>
33 using namespace WrtDB;
36 const DPL::String widgetPackage5(L"widgetpackage5");
39 RUNNER_TEST_GROUP_INIT(DAO)
42 * Name: home_network_data_usage
43 * Description: tests if HomeNetworkDataUsage is correctly set and get
44 * Expected: received developer shoudl match the one was set
46 RUNNER_TEST(home_network_data_usage)
48 GlobalDAO::NetworkAccessMode original =
49 GlobalDAO::GetHomeNetworkDataUsage();
51 GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::CONNECT_AUTOMATICALLY);
52 RUNNER_ASSERT_MSG(GlobalDAO::CONNECT_AUTOMATICALLY ==
53 GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
55 GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::ALWAYS_ASK);
56 RUNNER_ASSERT_MSG(GlobalDAO::ALWAYS_ASK ==
57 GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
59 GlobalDAO::SetHomeNetworkDataUsage(GlobalDAO::NEVER_CONNECT);
60 RUNNER_ASSERT_MSG(GlobalDAO::NEVER_CONNECT ==
61 GlobalDAO::GetHomeNetworkDataUsage(), "Value not updated");
63 GlobalDAO::SetHomeNetworkDataUsage(original);
64 RUNNER_ASSERT_MSG(original == GlobalDAO::GetHomeNetworkDataUsage(),
69 * Name: roaming_data_usage
70 * Description: tests if RoamingDataUsage is correctly set and get
71 * Expected: received developer shoudl match the one was set
73 RUNNER_TEST(roaming_data_usage)
75 GlobalDAO::NetworkAccessMode original =
76 GlobalDAO::GetRoamingDataUsage();
78 GlobalDAO::SetRoamingDataUsage(GlobalDAO::CONNECT_AUTOMATICALLY);
79 RUNNER_ASSERT_MSG(GlobalDAO::CONNECT_AUTOMATICALLY ==
80 GlobalDAO::GetRoamingDataUsage(), "Value not updated");
82 GlobalDAO::SetRoamingDataUsage(GlobalDAO::ALWAYS_ASK);
83 RUNNER_ASSERT_MSG(GlobalDAO::ALWAYS_ASK ==
84 GlobalDAO::GetRoamingDataUsage(), "Value not updated");
86 GlobalDAO::SetRoamingDataUsage(GlobalDAO::NEVER_CONNECT);
87 RUNNER_ASSERT_MSG(GlobalDAO::NEVER_CONNECT ==
88 GlobalDAO::GetRoamingDataUsage(), "Value not updated");
90 GlobalDAO::SetRoamingDataUsage(original);
91 RUNNER_ASSERT_MSG(original == GlobalDAO::GetRoamingDataUsage(),