OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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. |
| 4 |
| 5 #ifndef SYNC_TEST_LOCAL_SYNC_TEST_SERVER_H_ |
| 6 #define SYNC_TEST_LOCAL_SYNC_TEST_SERVER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "net/test/local_test_server.h" |
| 11 |
| 12 namespace syncer { |
| 13 |
| 14 // Runs a Python-based sync test server on the same machine on which the |
| 15 // LocalSyncTestServer runs. |
| 16 class LocalSyncTestServer : public net::LocalTestServer { |
| 17 public: |
| 18 // Initialize a sync server that listens on localhost using ephemeral ports |
| 19 // for sync and p2p notifications. |
| 20 LocalSyncTestServer(); |
| 21 |
| 22 // Initialize a sync server that listens on |port| for sync updates and |
| 23 // |xmpp_port| for p2p notifications. |
| 24 LocalSyncTestServer(uint16 port, uint16 xmpp_port); |
| 25 |
| 26 virtual ~LocalSyncTestServer(); |
| 27 |
| 28 // Calls LocalTestServer::AddCommandLineArguments and then appends the |
| 29 // --xmpp-port flag to |command_line| if required. Returns true on success. |
| 30 virtual bool AddCommandLineArguments( |
| 31 CommandLine* command_line) const OVERRIDE; |
| 32 |
| 33 // Calls LocalTestServer::SetPythonPath and then modifies PYTHONPATH to |
| 34 // contain libraries needed for the python sync server. |
| 35 virtual bool SetPythonPath() const OVERRIDE; |
| 36 |
| 37 // Returns true if the FilePath for the directory of the testserver python |
| 38 // script is successfully stored in |*directory|. |
| 39 virtual bool GetTestServerDirectory(FilePath* directory) const OVERRIDE; |
| 40 |
| 41 // Returns true if the FilePath for the testserver python script is |
| 42 // successfully stored in |*testserver_path|. |
| 43 virtual bool GetTestServerPath(FilePath* testserver_path) const OVERRIDE; |
| 44 |
| 45 // Returns true if the path to |test_script_name| is successfully stored in |
| 46 // |*test_script_path|. Used by the run_sync_testserver executable. |
| 47 bool GetTestScriptPath(const FilePath::StringType& test_script_name, |
| 48 FilePath* test_script_path) const; |
| 49 |
| 50 private: |
| 51 // Port on which the Sync XMPP server listens. |
| 52 uint16 xmpp_port_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(LocalSyncTestServer); |
| 55 }; |
| 56 |
| 57 } // namespace syncer |
| 58 |
| 59 #endif // SYNC_TEST_LOCAL_SYNC_TEST_SERVER_H_ |
OLD | NEW |