OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/test/live_sync/live_sync_test.h" | 5 #include "chrome/test/live_sync/live_sync_test.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 LOG(ERROR) << "Could not find valid xmpp_port value"; | 328 LOG(ERROR) << "Could not find valid xmpp_port value"; |
329 return false; | 329 return false; |
330 } | 330 } |
331 if ((xmpp_port <= 0) || (xmpp_port > kuint16max)) { | 331 if ((xmpp_port <= 0) || (xmpp_port > kuint16max)) { |
332 LOG(ERROR) << "Invalid xmpp port: " << xmpp_port; | 332 LOG(ERROR) << "Invalid xmpp port: " << xmpp_port; |
333 return false; | 333 return false; |
334 } | 334 } |
335 | 335 |
336 net::HostPortPair xmpp_host_port_pair(sync_server_.host_port_pair()); | 336 net::HostPortPair xmpp_host_port_pair(sync_server_.host_port_pair()); |
337 xmpp_host_port_pair.set_port(xmpp_port); | 337 xmpp_host_port_pair.set_port(xmpp_port); |
| 338 xmpp_port_.reset(new net::ScopedPortException(xmpp_port)); |
338 | 339 |
339 if (!cl->HasSwitch(switches::kSyncNotificationHost)) { | 340 if (!cl->HasSwitch(switches::kSyncNotificationHost)) { |
340 cl->AppendSwitchASCII(switches::kSyncNotificationHost, | 341 cl->AppendSwitchASCII(switches::kSyncNotificationHost, |
341 xmpp_host_port_pair.ToString()); | 342 xmpp_host_port_pair.ToString()); |
342 // The local XMPP server only supports insecure connections. | 343 // The local XMPP server only supports insecure connections. |
343 cl->AppendSwitch(switches::kSyncAllowInsecureXmppConnection); | 344 cl->AppendSwitch(switches::kSyncAllowInsecureXmppConnection); |
344 } | 345 } |
345 | 346 |
346 return true; | 347 return true; |
347 } | 348 } |
(...skipping 24 matching lines...) Expand all Loading... |
372 << cl->GetSwitchValueASCII(switches::kSyncServiceURL) << "."; | 373 << cl->GetSwitchValueASCII(switches::kSyncServiceURL) << "."; |
373 return false; | 374 return false; |
374 } | 375 } |
375 } | 376 } |
376 | 377 |
377 bool LiveSyncTest::TearDownLocalPythonTestServer() { | 378 bool LiveSyncTest::TearDownLocalPythonTestServer() { |
378 if (!sync_server_.Stop()) { | 379 if (!sync_server_.Stop()) { |
379 LOG(ERROR) << "Could not stop local python test server."; | 380 LOG(ERROR) << "Could not stop local python test server."; |
380 return false; | 381 return false; |
381 } | 382 } |
| 383 xmpp_port_.reset(); |
382 return true; | 384 return true; |
383 } | 385 } |
384 | 386 |
385 bool LiveSyncTest::TearDownLocalTestServer() { | 387 bool LiveSyncTest::TearDownLocalTestServer() { |
386 if (test_server_handle_ != base::kNullProcessHandle) { | 388 if (test_server_handle_ != base::kNullProcessHandle) { |
387 EXPECT_TRUE(base::KillProcess(test_server_handle_, 0, false)) | 389 EXPECT_TRUE(base::KillProcess(test_server_handle_, 0, false)) |
388 << "Could not stop local test server."; | 390 << "Could not stop local test server."; |
389 base::CloseProcessHandle(test_server_handle_); | 391 base::CloseProcessHandle(test_server_handle_); |
390 test_server_handle_ = base::kNullProcessHandle; | 392 test_server_handle_ = base::kNullProcessHandle; |
391 } | 393 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 const net::ProxyConfig& proxy_config) { | 440 const net::ProxyConfig& proxy_config) { |
439 base::WaitableEvent done(false, false); | 441 base::WaitableEvent done(false, false); |
440 BrowserThread::PostTask( | 442 BrowserThread::PostTask( |
441 BrowserThread::IO, | 443 BrowserThread::IO, |
442 FROM_HERE, | 444 FROM_HERE, |
443 new SetProxyConfigTask(&done, | 445 new SetProxyConfigTask(&done, |
444 context_getter, | 446 context_getter, |
445 proxy_config)); | 447 proxy_config)); |
446 done.Wait(); | 448 done.Wait(); |
447 } | 449 } |
OLD | NEW |