| 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 "jingle/notifier/communicator/connection_settings.h" | 5 #include "jingle/notifier/communicator/connection_settings.h" |
| 6 | 6 |
| 7 #include "jingle/notifier/base/server_information.h" | 7 #include "jingle/notifier/base/server_information.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace notifier { | 10 namespace notifier { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Make sure that servers that support SSLTCP get mapped to two | 37 // Make sure that servers that support SSLTCP get mapped to two |
| 38 // settings entries (with the SSLTCP one coming last) whereas those | 38 // settings entries (with the SSLTCP one coming last) whereas those |
| 39 // that don't map to only one. | 39 // that don't map to only one. |
| 40 TEST_F(ConnectionSettingsTest, Basic) { | 40 TEST_F(ConnectionSettingsTest, Basic) { |
| 41 const ConnectionSettingsList settings_list = | 41 const ConnectionSettingsList settings_list = |
| 42 MakeConnectionSettingsList(servers_, false /* try_ssltcp_first */); | 42 MakeConnectionSettingsList(servers_, false /* try_ssltcp_first */); |
| 43 | 43 |
| 44 ConnectionSettingsList expected_settings_list; | 44 ConnectionSettingsList expected_settings_list; |
| 45 expected_settings_list.push_back( | 45 expected_settings_list.push_back( |
| 46 ConnectionSettings( | 46 ConnectionSettings( |
| 47 talk_base::SocketAddress("supports_ssltcp.com", 100), | 47 rtc::SocketAddress("supports_ssltcp.com", 100), |
| 48 DO_NOT_USE_SSLTCP, | 48 DO_NOT_USE_SSLTCP, |
| 49 SUPPORTS_SSLTCP)); | 49 SUPPORTS_SSLTCP)); |
| 50 expected_settings_list.push_back( | 50 expected_settings_list.push_back( |
| 51 ConnectionSettings( | 51 ConnectionSettings( |
| 52 talk_base::SocketAddress("supports_ssltcp.com", 443), | 52 rtc::SocketAddress("supports_ssltcp.com", 443), |
| 53 USE_SSLTCP, | 53 USE_SSLTCP, |
| 54 SUPPORTS_SSLTCP)); | 54 SUPPORTS_SSLTCP)); |
| 55 expected_settings_list.push_back( | 55 expected_settings_list.push_back( |
| 56 ConnectionSettings( | 56 ConnectionSettings( |
| 57 talk_base::SocketAddress("does_not_support_ssltcp.com", 200), | 57 rtc::SocketAddress("does_not_support_ssltcp.com", 200), |
| 58 DO_NOT_USE_SSLTCP, | 58 DO_NOT_USE_SSLTCP, |
| 59 DOES_NOT_SUPPORT_SSLTCP)); | 59 DOES_NOT_SUPPORT_SSLTCP)); |
| 60 | 60 |
| 61 ASSERT_EQ(expected_settings_list.size(), settings_list.size()); | 61 ASSERT_EQ(expected_settings_list.size(), settings_list.size()); |
| 62 for (size_t i = 0; i < settings_list.size(); ++i) { | 62 for (size_t i = 0; i < settings_list.size(); ++i) { |
| 63 EXPECT_TRUE(settings_list[i].Equals(expected_settings_list[i])); | 63 EXPECT_TRUE(settings_list[i].Equals(expected_settings_list[i])); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Make sure that servers that support SSLTCP get mapped to two | 67 // Make sure that servers that support SSLTCP get mapped to two |
| 68 // settings entries (with the SSLTCP one coming first) when | 68 // settings entries (with the SSLTCP one coming first) when |
| 69 // try_ssltcp_first is set. | 69 // try_ssltcp_first is set. |
| 70 TEST_F(ConnectionSettingsTest, TrySslTcpFirst) { | 70 TEST_F(ConnectionSettingsTest, TrySslTcpFirst) { |
| 71 const ConnectionSettingsList settings_list = | 71 const ConnectionSettingsList settings_list = |
| 72 MakeConnectionSettingsList(servers_, true /* try_ssltcp_first */); | 72 MakeConnectionSettingsList(servers_, true /* try_ssltcp_first */); |
| 73 | 73 |
| 74 ConnectionSettingsList expected_settings_list; | 74 ConnectionSettingsList expected_settings_list; |
| 75 expected_settings_list.push_back( | 75 expected_settings_list.push_back( |
| 76 ConnectionSettings( | 76 ConnectionSettings( |
| 77 talk_base::SocketAddress("supports_ssltcp.com", 443), | 77 rtc::SocketAddress("supports_ssltcp.com", 443), |
| 78 USE_SSLTCP, | 78 USE_SSLTCP, |
| 79 SUPPORTS_SSLTCP)); | 79 SUPPORTS_SSLTCP)); |
| 80 expected_settings_list.push_back( | 80 expected_settings_list.push_back( |
| 81 ConnectionSettings( | 81 ConnectionSettings( |
| 82 talk_base::SocketAddress("supports_ssltcp.com", 100), | 82 rtc::SocketAddress("supports_ssltcp.com", 100), |
| 83 DO_NOT_USE_SSLTCP, | 83 DO_NOT_USE_SSLTCP, |
| 84 SUPPORTS_SSLTCP)); | 84 SUPPORTS_SSLTCP)); |
| 85 expected_settings_list.push_back( | 85 expected_settings_list.push_back( |
| 86 ConnectionSettings( | 86 ConnectionSettings( |
| 87 talk_base::SocketAddress("does_not_support_ssltcp.com", 200), | 87 rtc::SocketAddress("does_not_support_ssltcp.com", 200), |
| 88 DO_NOT_USE_SSLTCP, | 88 DO_NOT_USE_SSLTCP, |
| 89 DOES_NOT_SUPPORT_SSLTCP)); | 89 DOES_NOT_SUPPORT_SSLTCP)); |
| 90 | 90 |
| 91 ASSERT_EQ(expected_settings_list.size(), settings_list.size()); | 91 ASSERT_EQ(expected_settings_list.size(), settings_list.size()); |
| 92 for (size_t i = 0; i < settings_list.size(); ++i) { | 92 for (size_t i = 0; i < settings_list.size(); ++i) { |
| 93 EXPECT_TRUE(settings_list[i].Equals(expected_settings_list[i])); | 93 EXPECT_TRUE(settings_list[i].Equals(expected_settings_list[i])); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace | 97 } // namespace |
| 98 | 98 |
| 99 } // namespace notifier | 99 } // namespace notifier |
| OLD | NEW |