OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
8 extern "C" { | 8 extern "C" { |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 } | 10 } |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 NewCallback(connection, &ProtocolTestConnection::OnStateChange))); | 299 NewCallback(connection, &ProtocolTestConnection::OnStateChange))); |
300 connections_.push_back(make_scoped_refptr(connection)); | 300 connections_.push_back(make_scoped_refptr(connection)); |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 void ProtocolTestClient::OnIncomingSession( | 304 void ProtocolTestClient::OnIncomingSession( |
305 Session* session, | 305 Session* session, |
306 SessionManager::IncomingSessionResponse* response) { | 306 SessionManager::IncomingSessionResponse* response) { |
307 std::cerr << "Accepting connection from " << session->jid() << std::endl; | 307 std::cerr << "Accepting connection from " << session->jid() << std::endl; |
308 | 308 |
309 session->set_config(SessionConfig::CreateDefault()); | 309 session->set_config(SessionConfig::GetDefault()); |
310 *response = SessionManager::ACCEPT; | 310 *response = SessionManager::ACCEPT; |
311 | 311 |
312 ProtocolTestConnection* test_connection = new ProtocolTestConnection(this); | 312 ProtocolTestConnection* test_connection = new ProtocolTestConnection(this); |
313 session->SetStateChangeCallback( | 313 session->SetStateChangeCallback( |
314 NewCallback(test_connection, &ProtocolTestConnection::OnStateChange)); | 314 NewCallback(test_connection, &ProtocolTestConnection::OnStateChange)); |
315 test_connection->Init(session); | 315 test_connection->Init(session); |
316 base::AutoLock auto_lock(connections_lock_); | 316 base::AutoLock auto_lock(connections_lock_); |
317 connections_.push_back(make_scoped_refptr(test_connection)); | 317 connections_.push_back(make_scoped_refptr(test_connection)); |
318 } | 318 } |
319 | 319 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 std::string auth_service("oauth2"); | 359 std::string auth_service("oauth2"); |
360 if (cmd_line->HasSwitch("auth_service")) | 360 if (cmd_line->HasSwitch("auth_service")) |
361 auth_service = cmd_line->GetSwitchValueASCII("auth_service"); | 361 auth_service = cmd_line->GetSwitchValueASCII("auth_service"); |
362 | 362 |
363 scoped_refptr<ProtocolTestClient> client(new ProtocolTestClient()); | 363 scoped_refptr<ProtocolTestClient> client(new ProtocolTestClient()); |
364 | 364 |
365 client->Run(username, auth_token, host_jid, auth_service); | 365 client->Run(username, auth_token, host_jid, auth_service); |
366 | 366 |
367 return 0; | 367 return 0; |
368 } | 368 } |
OLD | NEW |