[Sync] Make sync integration tests use local xmpp servers.
Fixed signed/unsigned bug with the port number. BUG=53934 TEST=sync integration tests Review URL: http://codereview.chromium.org/5239001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67491 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome/test/live_sync
jingle/notifier/communicator
net/test
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/basictypes.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/task.h"
|
#include "base/task.h"
|
||||||
#include "base/test/test_timeouts.h"
|
#include "base/test/test_timeouts.h"
|
||||||
|
#include "base/values.h"
|
||||||
#include "base/waitable_event.h"
|
#include "base/waitable_event.h"
|
||||||
#include "chrome/browser/browser_thread.h"
|
#include "chrome/browser/browser_thread.h"
|
||||||
#include "chrome/browser/password_manager/encryptor.h"
|
#include "chrome/browser/password_manager/encryptor.h"
|
||||||
@@ -139,17 +141,6 @@ void LiveSyncTest::SetUp() {
|
|||||||
if (!cl->HasSwitch(switches::kSyncNotificationMethod))
|
if (!cl->HasSwitch(switches::kSyncNotificationMethod))
|
||||||
cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p");
|
cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p");
|
||||||
|
|
||||||
// TODO(akalin): Delete this block of code once a local python notification
|
|
||||||
// server is implemented.
|
|
||||||
// The chrome sync builders are behind a firewall that blocks port 5222, the
|
|
||||||
// default port for XMPP notifications. This causes the tests to spend up to a
|
|
||||||
// minute waiting for a connection on port 5222 before they fail over to port
|
|
||||||
// 443, the default SSL/TCP port. This switch causes the tests to use port 443
|
|
||||||
// by default, without having to try port 5222.
|
|
||||||
if (!cl->HasSwitch(switches::kSyncTrySsltcpFirstForXmpp)) {
|
|
||||||
cl->AppendSwitch(switches::kSyncTrySsltcpFirstForXmpp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(sync): Remove this once sessions sync is enabled by default.
|
// TODO(sync): Remove this once sessions sync is enabled by default.
|
||||||
if (!cl->HasSwitch(switches::kEnableSyncSessions)) {
|
if (!cl->HasSwitch(switches::kEnableSyncSessions)) {
|
||||||
cl->AppendSwitch(switches::kEnableSyncSessions);
|
cl->AppendSwitch(switches::kEnableSyncSessions);
|
||||||
@@ -332,8 +323,25 @@ bool LiveSyncTest::SetUpLocalPythonTestServer() {
|
|||||||
cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url);
|
cl->AppendSwitchASCII(switches::kSyncServiceURL, sync_service_url);
|
||||||
VLOG(1) << "Started local python test server at " << sync_service_url;
|
VLOG(1) << "Started local python test server at " << sync_service_url;
|
||||||
|
|
||||||
// TODO(akalin): Set the kSyncNotificationHost switch here once a local python
|
int xmpp_port = 0;
|
||||||
// notification server is implemented.
|
if (!sync_server_.server_data().GetInteger("xmpp_port", &xmpp_port)) {
|
||||||
|
LOG(ERROR) << "Could not find valid xmpp_port value";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((xmpp_port <= 0) || (xmpp_port > kuint16max)) {
|
||||||
|
LOG(ERROR) << "Invalid xmpp port: " << xmpp_port;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
net::HostPortPair xmpp_host_port_pair(sync_server_.host_port_pair());
|
||||||
|
xmpp_host_port_pair.set_port(xmpp_port);
|
||||||
|
|
||||||
|
if (!cl->HasSwitch(switches::kSyncNotificationHost)) {
|
||||||
|
cl->AppendSwitchASCII(switches::kSyncNotificationHost,
|
||||||
|
xmpp_host_port_pair.ToString());
|
||||||
|
// The local XMPP server only supports insecure connections.
|
||||||
|
cl->AppendSwitch(switches::kSyncAllowInsecureXmppConnection);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ ConnectionSettingsList::~ConnectionSettingsList() {}
|
|||||||
|
|
||||||
void ConnectionSettingsList::AddPermutations(const std::string& hostname,
|
void ConnectionSettingsList::AddPermutations(const std::string& hostname,
|
||||||
const std::vector<uint32>& iplist,
|
const std::vector<uint32>& iplist,
|
||||||
int16 port,
|
uint16 port,
|
||||||
bool special_port_magic,
|
bool special_port_magic,
|
||||||
bool try_ssltcp_first) {
|
bool try_ssltcp_first) {
|
||||||
// randomize the list. This ensures the iplist isn't always
|
// randomize the list. This ensures the iplist isn't always
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/basictypes.h"
|
||||||
#include "talk/xmpp/xmppclientsettings.h"
|
#include "talk/xmpp/xmppclientsettings.h"
|
||||||
|
|
||||||
namespace notifier {
|
namespace notifier {
|
||||||
@@ -47,7 +48,7 @@ class ConnectionSettingsList {
|
|||||||
|
|
||||||
void AddPermutations(const std::string& hostname,
|
void AddPermutations(const std::string& hostname,
|
||||||
const std::vector<uint32>& iplist,
|
const std::vector<uint32>& iplist,
|
||||||
int16 port,
|
uint16 port,
|
||||||
bool special_port_magic,
|
bool special_port_magic,
|
||||||
bool try_ssltcp_first);
|
bool try_ssltcp_first);
|
||||||
private:
|
private:
|
||||||
|
@@ -189,6 +189,11 @@ const HostPortPair& TestServer::host_port_pair() const {
|
|||||||
return host_port_pair_;
|
return host_port_pair_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DictionaryValue& TestServer::server_data() const {
|
||||||
|
DCHECK(started_);
|
||||||
|
return *server_data_;
|
||||||
|
}
|
||||||
|
|
||||||
std::string TestServer::GetScheme() const {
|
std::string TestServer::GetScheme() const {
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case TYPE_FTP:
|
case TYPE_FTP:
|
||||||
@@ -391,9 +396,9 @@ bool TestServer::ParseServerData(const std::string& server_data) {
|
|||||||
<< json_reader.GetErrorMessage();
|
<< json_reader.GetErrorMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
DictionaryValue* dict = static_cast<DictionaryValue*>(value.get());
|
server_data_.reset(static_cast<DictionaryValue*>(value.release()));
|
||||||
int port = 0;
|
int port = 0;
|
||||||
if (!dict->GetInteger("port", &port)) {
|
if (!server_data_->GetInteger("port", &port)) {
|
||||||
LOG(ERROR) << "Could not find port value";
|
LOG(ERROR) << "Could not find port value";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CommandLine;
|
class CommandLine;
|
||||||
|
class DictionaryValue;
|
||||||
class GURL;
|
class GURL;
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
@@ -116,6 +117,7 @@ class TestServer {
|
|||||||
|
|
||||||
const FilePath& document_root() const { return document_root_; }
|
const FilePath& document_root() const { return document_root_; }
|
||||||
const HostPortPair& host_port_pair() const;
|
const HostPortPair& host_port_pair() const;
|
||||||
|
const DictionaryValue& server_data() const;
|
||||||
std::string GetScheme() const;
|
std::string GetScheme() const;
|
||||||
bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT;
|
bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
@@ -172,6 +174,9 @@ class TestServer {
|
|||||||
// Address the test server listens on.
|
// Address the test server listens on.
|
||||||
HostPortPair host_port_pair_;
|
HostPortPair host_port_pair_;
|
||||||
|
|
||||||
|
// Holds the data sent from the server (e.g., port number).
|
||||||
|
scoped_ptr<DictionaryValue> server_data_;
|
||||||
|
|
||||||
// Handle of the Python process running the test server.
|
// Handle of the Python process running the test server.
|
||||||
base::ProcessHandle process_handle_;
|
base::ProcessHandle process_handle_;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user