Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / net / test / spawned_test_server / remote_test_server.h
bloba8b8bb2c23591cb008266faed5afd7f50e02d4ef
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 #ifndef NET_TEST_SPAWNED_TEST_SERVER_REMOTE_TEST_SERVER_H_
6 #define NET_TEST_SPAWNED_TEST_SERVER_REMOTE_TEST_SERVER_H_
8 #include <string>
10 #include "net/test/spawned_test_server/base_test_server.h"
12 namespace net {
14 class SpawnerCommunicator;
16 // The RemoteTestServer runs an external Python-based test server in another
17 // machine that is different from the machine in which RemoteTestServer runs.
18 class RemoteTestServer : public BaseTestServer {
19 public:
20 // Initialize a TestServer listening on a specific host (IP or hostname).
21 // |document_root| must be a relative path under the root tree.
22 RemoteTestServer(Type type,
23 const std::string& host,
24 const base::FilePath& document_root);
26 // Initialize a TestServer with a specific set of SSLOptions.
27 // |document_root| must be a relative path under the root tree.
28 RemoteTestServer(Type type,
29 const SSLOptions& ssl_options,
30 const base::FilePath& document_root);
32 ~RemoteTestServer() override;
34 // Starts the Python test server on the host, instead of on the device, and
35 // blocks until the server is ready.
36 bool Start() WARN_UNUSED_RESULT;
38 // These are currently unused and unimplemented for RemoteTestServer. See
39 // the same methods in LocalTestServer for more information.
40 bool StartInBackground() WARN_UNUSED_RESULT;
41 bool BlockUntilStarted() WARN_UNUSED_RESULT;
43 // Stops the Python test server that is running on the host machine.
44 bool Stop();
46 // Returns the actual path of document root for the test cases. This function
47 // should be called by test cases to retrieve the actual document root path
48 // on the Android device, otherwise document_root() function is used to get
49 // the document root.
50 base::FilePath GetDocumentRoot() const;
52 private:
53 bool Init(const base::FilePath& document_root);
55 // The local port used to communicate with the TestServer spawner. This is
56 // used to control the startup and shutdown of the Python TestServer running
57 // on the remote machine. On Android, this port will be redirected to the
58 // same port on the host machine.
59 int spawner_server_port_;
61 // Helper to start and stop instances of the Python test server that runs on
62 // the host machine.
63 scoped_ptr<SpawnerCommunicator> spawner_communicator_;
65 DISALLOW_COPY_AND_ASSIGN(RemoteTestServer);
68 } // namespace net
70 #endif // NET_TEST_SPAWNED_TEST_SERVER_REMOTE_TEST_SERVER_H_