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
3 // found in the LICENSE file.
5 #include "jingle/notifier/communicator/login_settings.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webrtc/libjingle/xmpp/xmppclientsettings.h"
16 const char kAuthMechanism
[] = "auth_mechanism";
18 class LoginSettingsTest
: public ::testing::Test
{
23 net::HostPortPair("default.com", 100),
24 DOES_NOT_SUPPORT_SSLTCP
));
30 TEST_F(LoginSettingsTest
, Basic
) {
31 const LoginSettings
login_settings(buzz::XmppClientSettings(),
34 false /* try_ssltcp_first */,
36 EXPECT_EQ(base::Time(), login_settings
.GetRedirectExpirationForTest());
37 const ServerList
& servers
= login_settings
.GetServers();
38 ASSERT_EQ(servers_
.size(), servers
.size());
39 for (size_t i
= 0; i
< servers
.size(); ++i
) {
40 EXPECT_TRUE(servers
[i
].Equals(servers_
[i
]));
44 TEST_F(LoginSettingsTest
, Redirect
) {
45 LoginSettings
login_settings(buzz::XmppClientSettings(),
48 false /* try_ssltcp_first */,
50 const ServerInformation
redirect_server(
51 net::HostPortPair("redirect.com", 200),
53 login_settings
.SetRedirectServer(redirect_server
);
56 const ServerList
& servers
=
57 login_settings
.GetServersForTimeForTest(
58 login_settings
.GetRedirectExpirationForTest() -
59 base::TimeDelta::FromMilliseconds(1));
60 ASSERT_EQ(servers_
.size(), 1u);
61 EXPECT_TRUE(servers
[0].Equals(redirect_server
));
65 const ServerList
& servers
=
66 login_settings
.GetServersForTimeForTest(
67 login_settings
.GetRedirectExpirationForTest());
68 ASSERT_EQ(servers_
.size(), servers
.size());
69 for (size_t i
= 0; i
< servers
.size(); ++i
) {
70 EXPECT_TRUE(servers
[i
].Equals(servers_
[i
]));
77 } // namespace notifier