[PATCH xorg-gtest 07/16] xserver: add Start() for default binary path
Chase Douglas
chase.douglas at canonical.com
Tue Jul 3 10:40:23 PDT 2012
On 07/02/2012 11:44 PM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> include/xorg/gtest/xorg-gtest-xserver.h | 4 ++++
> src/xserver.cpp | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/xorg/gtest/xorg-gtest-xserver.h b/include/xorg/gtest/xorg-gtest-xserver.h
> index 821b01f..33331cd 100644
> --- a/include/xorg/gtest/xorg-gtest-xserver.h
> +++ b/include/xorg/gtest/xorg-gtest-xserver.h
> @@ -47,6 +47,10 @@ class XServer : public xorg::testing::Process {
> XServer();
>
> /**
> + * Start a new server, using the default binary
> + */
> + void Start(void);
This can be accomplished by defining the previous definition of Start()
like:
void Start(std::string &program = std::string());
(or something like that, the idea is to provide a default value)
Then, in the implementationm check program.empty(). If it is, then use
the default value. If it isn't, then used the passed in value.
However, this interface just feels wrong. Why have we defined an
internal path to the server, and then defined a method that ignores it?
Ideally, at the XServer object construction time we either set a default
program or we pass in the initial program. We then only provide getters
and setters, and a method to start the program.
> + /**
> * Start a new server
> * @param [in] program Path to the XServer binary
> */
> diff --git a/src/xserver.cpp b/src/xserver.cpp
> index bd1e2f9..160eadc 100644
> --- a/src/xserver.cpp
> +++ b/src/xserver.cpp
> @@ -289,6 +289,10 @@ void xorg::testing::XServer::TestStartup(void) {
>
> }
>
> +void xorg::testing::XServer::Start(void) {
> + Start(d_->path_to_server);
> +}
> +
> void xorg::testing::XServer::Start(std::string &program) {
> TestStartup();
> Process::Start(program, program.c_str(),
>
More information about the xorg-devel
mailing list