OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <cert.h> | 5 #include <cert.h> |
6 #include <pk11pub.h> | 6 #include <pk11pub.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 wifi->SetName(wifi_setname2); | 144 wifi->SetName(wifi_setname2); |
145 EXPECT_EQ(wifi->name(), wifi_setname2_result); | 145 EXPECT_EQ(wifi->name(), wifi_setname2_result); |
146 delete wifi; | 146 delete wifi; |
147 } | 147 } |
148 | 148 |
149 // UTF8 SSID | 149 // UTF8 SSID |
150 { | 150 { |
151 std::string wifi_utf8 = "UTF-8 \u3042\u3044\u3046"; | 151 std::string wifi_utf8 = "UTF-8 \u3042\u3044\u3046"; |
152 std::string wifi_utf8_result = "UTF-8 \xE3\x81\x82\xE3\x81\x84\xE3\x81\x86"; | 152 std::string wifi_utf8_result = "UTF-8 \xE3\x81\x82\xE3\x81\x84\xE3\x81\x86"; |
153 WifiNetwork* wifi = new WifiNetwork("fw"); | 153 WifiNetwork* wifi = new WifiNetwork("fw"); |
154 wifi->SetSsid(wifi_utf8); | 154 WifiNetwork::TestApi test_wifi(wifi); |
| 155 test_wifi.SetSsid(wifi_utf8); |
155 EXPECT_EQ(wifi->name(), wifi_utf8_result); | 156 EXPECT_EQ(wifi->name(), wifi_utf8_result); |
156 delete wifi; | 157 delete wifi; |
157 } | 158 } |
158 | 159 |
159 // latin1 SSID -> UTF8 SSID | 160 // latin1 SSID -> UTF8 SSID |
160 { | 161 { |
161 std::string wifi_latin1 = "latin-1 \xc0\xcb\xcc\xd6\xfb"; | 162 std::string wifi_latin1 = "latin-1 \xc0\xcb\xcc\xd6\xfb"; |
162 std::string wifi_latin1_result = "latin-1 \u00c0\u00cb\u00cc\u00d6\u00fb"; | 163 std::string wifi_latin1_result = "latin-1 \u00c0\u00cb\u00cc\u00d6\u00fb"; |
163 WifiNetwork* wifi = new WifiNetwork("fw"); | 164 WifiNetwork* wifi = new WifiNetwork("fw"); |
164 wifi->SetSsid(wifi_latin1); | 165 WifiNetwork::TestApi test_wifi(wifi); |
| 166 test_wifi.SetSsid(wifi_latin1); |
165 EXPECT_EQ(wifi->name(), wifi_latin1_result); | 167 EXPECT_EQ(wifi->name(), wifi_latin1_result); |
166 delete wifi; | 168 delete wifi; |
167 } | 169 } |
168 | 170 |
169 // Hex SSID | 171 // Hex SSID |
170 { | 172 { |
171 std::string wifi_hex = "5468697320697320484558205353494421"; | 173 std::string wifi_hex = "5468697320697320484558205353494421"; |
172 std::string wifi_hex_result = "This is HEX SSID!"; | 174 std::string wifi_hex_result = "This is HEX SSID!"; |
173 WifiNetwork* wifi = new WifiNetwork("fw"); | 175 WifiNetwork* wifi = new WifiNetwork("fw"); |
174 wifi->SetHexSsid(wifi_hex); | 176 WifiNetwork::TestApi test_wifi(wifi); |
| 177 test_wifi.SetHexSsid(wifi_hex); |
175 EXPECT_EQ(wifi->name(), wifi_hex_result); | 178 EXPECT_EQ(wifi->name(), wifi_hex_result); |
176 delete wifi; | 179 delete wifi; |
177 } | 180 } |
178 } | 181 } |
179 | 182 |
180 // Create a stub libcros for testing NetworkLibrary functionality through | 183 // Create a stub libcros for testing NetworkLibrary functionality through |
181 // NetworkLibraryStubImpl. | 184 // NetworkLibraryStubImpl. |
182 // NOTE: It would be of little value to test stub functions that simply return | 185 // NOTE: It would be of little value to test stub functions that simply return |
183 // predefined values, e.g. ethernet_available(). However, many other functions | 186 // predefined values, e.g. ethernet_available(). However, many other functions |
184 // such as connected_network() return values which are set indirectly and thus | 187 // such as connected_network() return values which are set indirectly and thus |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 424 |
422 // TODO(stevenjb): Test network profiles. | 425 // TODO(stevenjb): Test network profiles. |
423 | 426 |
424 // TODO(stevenjb): Test network devices. | 427 // TODO(stevenjb): Test network devices. |
425 | 428 |
426 // TODO(stevenjb): Test data plans. | 429 // TODO(stevenjb): Test data plans. |
427 | 430 |
428 // TODO(stevenjb): Test monitor network / device. | 431 // TODO(stevenjb): Test monitor network / device. |
429 | 432 |
430 } // namespace chromeos | 433 } // namespace chromeos |
OLD | NEW |