diff options
author | jnd@chromium.org <jnd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 06:04:43 +0000 |
---|---|---|
committer | jnd@chromium.org <jnd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 06:04:43 +0000 |
commit | 31526823f1e7e7f1418f44cfb0f4e0283daf54ec (patch) | |
tree | b751259ceec955513fcceaec3272316570e0d33c /net/test/remote_test_server.h | |
parent | e4f849682312f4300e6447b7227650e38c8d8415 (diff) | |
download | chromium_src-31526823f1e7e7f1418f44cfb0f4e0283daf54ec.zip chromium_src-31526823f1e7e7f1418f44cfb0f4e0283daf54ec.tar.gz chromium_src-31526823f1e7e7f1418f44cfb0f4e0283daf54ec.tar.bz2 |
Make test server to talk with the python test server which is running on remote machine.
For Chromium/Android platform, since there is no python env support on Android device, we have to run the test server on the remote host and let the test server to talk with it.
Also add the net_util.h into some test files to fix compilation error. They used to implicitly rely on the net_util.h definition by including test_server.h, but the net_util.h is removed from test_server.h in this patch.
Since the fix in those test files are trivial, Ryan and Paweł are OK with the patch, just TBR to the owners to skip the owner presubmit check for landing.
TBR=owners
BUG=None
TEST=net_unittests should pass on all platforms
Review URL: http://codereview.chromium.org/9359051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test/remote_test_server.h')
-rw-r--r-- | net/test/remote_test_server.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/net/test/remote_test_server.h b/net/test/remote_test_server.h new file mode 100644 index 0000000..1f375cb --- /dev/null +++ b/net/test/remote_test_server.h @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_TEST_REMOTE_TEST_SERVER_H_ +#define NET_TEST_REMOTE_TEST_SERVER_H_ +#pragma once + +#include <string> + +#include "net/test/base_test_server.h" + +namespace net { + +class SpawnerCommunicator; + +// The RemoteTestServer runs an external Python-based test server in another +// machine that is different from the machine in which RemoteTestServer runs. +class RemoteTestServer : public BaseTestServer { + public: + // Initialize a TestServer listening on a specific host (IP or hostname). + // |document_root| must be a relative path under the root tree. + RemoteTestServer(Type type, + const std::string& host, + const FilePath& document_root); + + // Initialize a HTTPS TestServer with a specific set of HTTPSOptions. + // |document_root| must be a relative path under the root tree. + RemoteTestServer(const HTTPSOptions& https_options, + const FilePath& document_root); + + ~RemoteTestServer(); + + // Starts the Python test server on the host, instead of on the device. + bool Start() WARN_UNUSED_RESULT; + + // Stops the Python test server that is running on the host machine. + bool Stop(); + + private: + bool Init(const FilePath& document_root); + + // Helper to start and stop instances of the Python test server that runs on + // the host machine. + scoped_ptr<SpawnerCommunicator> spawner_communicator_; + + DISALLOW_COPY_AND_ASSIGN(RemoteTestServer); +}; + +} // namespace net + +#endif // NET_TEST_REMOTE_TEST_SERVER_H_ + |