| 264 | } |
| 265 | |
| 266 | void OptionHandlerTest::testHttpProxyOptionHandler() |
| 267 | { |
| 268 | HttpProxyOptionHandler handler(PREF_HTTP_PROXY, "", ""); |
| 269 | Option option; |
| 270 | handler.parse(option, "proxy:65535"); |
| 271 | CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:65535/"), |
| 272 | option.get(PREF_HTTP_PROXY)); |
| 273 | |
| 274 | handler.parse(option, "http://proxy:8080"); |
| 275 | CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:8080/"), |
| 276 | option.get(PREF_HTTP_PROXY)); |
| 277 | |
| 278 | handler.parse(option, ""); |
| 279 | CPPUNIT_ASSERT(option.defined(PREF_HTTP_PROXY)); |
| 280 | CPPUNIT_ASSERT(option.blank(PREF_HTTP_PROXY)); |
| 281 | |
| 282 | try { |
| 283 | handler.parse(option, "http://bar:65536"); |
| 284 | CPPUNIT_FAIL("exception must be thrown."); |
| 285 | } |
| 286 | catch (Exception& e) { |
| 287 | } |
| 288 | CPPUNIT_ASSERT_EQUAL(std::string("[http://][USER:PASSWORD@]HOST[:PORT]"), |
| 289 | handler.createPossibleValuesString()); |
| 290 | |
| 291 | handler.parse(option, "http://user%40:passwd%40@proxy:8080"); |
| 292 | CPPUNIT_ASSERT_EQUAL(std::string("http://user%40:passwd%40@proxy:8080/"), |
| 293 | option.get(PREF_HTTP_PROXY)); |
| 294 | |
| 295 | handler.parse(option, "http://[::1]:8080"); |
| 296 | CPPUNIT_ASSERT_EQUAL(std::string("http://[::1]:8080/"), |
| 297 | option.get(PREF_HTTP_PROXY)); |
| 298 | } |
| 299 | |
| 300 | void OptionHandlerTest::testDeprecatedOptionHandler() |
| 301 | { |
nothing calls this directly
no test coverage detected