~thomas-voss/location-service/flatten

« back to all changes in this revision

Viewing changes to tests/connectivity_manager_test.cpp

  • Committer: thomas-voss
  • Date: 2015-02-03 12:21:33 UTC
  • Revision ID: thomas.voss@canonical.com-20150203122133-660kjot28cz7dx6m
Adjust namespace to core::location for all classes not in com::ubuntu::location::connectivity.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include <gtest/gtest.h>
34
34
 
35
 
namespace location = com::ubuntu::location;
 
35
namespace location = core::location;
36
36
namespace connectivity = com::ubuntu::location::connectivity;
37
37
 
38
38
namespace
98
98
TEST(RadioCell, explicit_construction_yields_correct_type)
99
99
{
100
100
    {
101
 
        location::connectivity::RadioCell::Gsm gsm
102
 
        {
103
 
            location::connectivity::RadioCell::Gsm::MCC{42},
104
 
            location::connectivity::RadioCell::Gsm::MNC{42},
105
 
            location::connectivity::RadioCell::Gsm::LAC{42},
106
 
            location::connectivity::RadioCell::Gsm::ID{42},
107
 
            location::connectivity::RadioCell::Gsm::SignalStrength{21}
108
 
        };
109
 
 
110
 
        location::connectivity::RadioCell cell{gsm};
111
 
 
112
 
        EXPECT_EQ(location::connectivity::RadioCell::Type::gsm, cell.type());
113
 
    }
114
 
 
115
 
    {
116
 
        location::connectivity::RadioCell::Umts umts
117
 
        {
118
 
            location::connectivity::RadioCell::Umts::MCC{42},
119
 
            location::connectivity::RadioCell::Umts::MNC{42},
120
 
            location::connectivity::RadioCell::Umts::LAC{42},
121
 
            location::connectivity::RadioCell::Umts::ID{42},
122
 
            location::connectivity::RadioCell::Umts::SignalStrength{21}
123
 
        };
124
 
 
125
 
        location::connectivity::RadioCell cell{umts};
126
 
 
127
 
        EXPECT_EQ(location::connectivity::RadioCell::Type::umts, cell.type());
128
 
    }
129
 
 
130
 
    {
131
 
        location::connectivity::RadioCell::Lte lte
132
 
        {
133
 
            location::connectivity::RadioCell::Lte::MCC{42},
134
 
            location::connectivity::RadioCell::Lte::MNC{42},
135
 
            location::connectivity::RadioCell::Lte::TAC{42},
136
 
            location::connectivity::RadioCell::Lte::ID{42},
137
 
            location::connectivity::RadioCell::Lte::PID{42},
138
 
            location::connectivity::RadioCell::Lte::SignalStrength{21}
139
 
        };
140
 
 
141
 
        location::connectivity::RadioCell cell{lte};
142
 
 
143
 
        EXPECT_EQ(location::connectivity::RadioCell::Type::lte, cell.type());
 
101
        connectivity::RadioCell::Gsm gsm
 
102
        {
 
103
            connectivity::RadioCell::Gsm::MCC{42},
 
104
            connectivity::RadioCell::Gsm::MNC{42},
 
105
            connectivity::RadioCell::Gsm::LAC{42},
 
106
            connectivity::RadioCell::Gsm::ID{42},
 
107
            connectivity::RadioCell::Gsm::SignalStrength{21}
 
108
        };
 
109
 
 
110
        connectivity::RadioCell cell{gsm};
 
111
 
 
112
        EXPECT_EQ(connectivity::RadioCell::Type::gsm, cell.type());
 
113
    }
 
114
 
 
115
    {
 
116
        connectivity::RadioCell::Umts umts
 
117
        {
 
118
            connectivity::RadioCell::Umts::MCC{42},
 
119
            connectivity::RadioCell::Umts::MNC{42},
 
120
            connectivity::RadioCell::Umts::LAC{42},
 
121
            connectivity::RadioCell::Umts::ID{42},
 
122
            connectivity::RadioCell::Umts::SignalStrength{21}
 
123
        };
 
124
 
 
125
        connectivity::RadioCell cell{umts};
 
126
 
 
127
        EXPECT_EQ(connectivity::RadioCell::Type::umts, cell.type());
 
128
    }
 
129
 
 
130
    {
 
131
        connectivity::RadioCell::Lte lte
 
132
        {
 
133
            connectivity::RadioCell::Lte::MCC{42},
 
134
            connectivity::RadioCell::Lte::MNC{42},
 
135
            connectivity::RadioCell::Lte::TAC{42},
 
136
            connectivity::RadioCell::Lte::ID{42},
 
137
            connectivity::RadioCell::Lte::PID{42},
 
138
            connectivity::RadioCell::Lte::SignalStrength{21}
 
139
        };
 
140
 
 
141
        connectivity::RadioCell cell{lte};
 
142
 
 
143
        EXPECT_EQ(connectivity::RadioCell::Type::lte, cell.type());
144
144
    }
145
145
}*/
146
146
 
147
147
TEST(ConnectivityManagerOnDevice, repeatedly_requesting_network_scans_works_requires_hardware)
148
148
{
149
 
    auto manager = location::connectivity::platform_default_manager();
 
149
    auto manager = connectivity::platform_default_manager();
150
150
 
151
151
    for (unsigned int i = 0; i < 100; i++)
152
152
        manager->request_scan_for_wireless_networks();
154
154
 
155
155
TEST(ConnectivityManagerOnDevice, repeatedly_querying_the_connected_cell_works_requires_hardware)
156
156
{
157
 
    auto manager = location::connectivity::platform_default_manager();
 
157
    auto manager = connectivity::platform_default_manager();
158
158
 
159
159
    for (unsigned int i = 0; i < 100; i++)
160
160
    {
161
 
        manager->enumerate_connected_radio_cells([](const location::connectivity::RadioCell::Ptr& cell)
 
161
        manager->enumerate_connected_radio_cells([](const connectivity::RadioCell::Ptr& cell)
162
162
        {
163
163
            std::cout << *cell << std::endl;
164
164
        });
167
167
 
168
168
TEST(ConnectivityManagerOnDevice, default_implementation_is_queryable_for_wifis_and_radio_cells_requires_hardware)
169
169
{
170
 
    auto manager = location::connectivity::platform_default_manager();
 
170
    auto manager = connectivity::platform_default_manager();
171
171
 
172
 
    manager->enumerate_connected_radio_cells([](const location::connectivity::RadioCell::Ptr& cell)
 
172
    manager->enumerate_connected_radio_cells([](const connectivity::RadioCell::Ptr& cell)
173
173
    {
174
174
        std::cout << *cell << std::endl;
175
175
    });
176
176
 
177
 
    manager->enumerate_visible_wireless_networks([](location::connectivity::WirelessNetwork::Ptr wifi)
 
177
    manager->enumerate_visible_wireless_networks([](connectivity::WirelessNetwork::Ptr wifi)
178
178
    {
179
179
        std::cout << *wifi << std::endl;
180
180
    });
182
182
 
183
183
TEST(ConnectivityManagerOnDevice, default_implementation_is_queryable_for_wifi_and_wwan_status_requires_hardware)
184
184
{
185
 
    auto manager = location::connectivity::platform_default_manager();
 
185
    auto manager = connectivity::platform_default_manager();
186
186
 
187
187
    std::cout << std::boolalpha << manager->is_wifi_enabled().get() << std::endl;
188
188
    std::cout << std::boolalpha << manager->is_wwan_enabled().get() << std::endl;