summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media/test_license_server.h
blob: 37e710b42af0af66e5e9c36bec7488a1b5b5cee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2014 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 CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_
#define CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_

#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/process/process_handle.h"

class TestLicenseServerConfig;

// Class used to start a test license server.
class TestLicenseServer {
 public:
  explicit TestLicenseServer(scoped_ptr<TestLicenseServerConfig> server_config);
  ~TestLicenseServer();

  // Returns true if the server started successfully. False otherwise.
  bool Start();
  // Returns true if the server was stopped successfully. False otherwise.
  bool Stop();
  // Returns a string containing the URL and port the server is listening to.
  std::string GetServerURL();

 private:
  // License server configuration class used to obtain server paths, etc.
  scoped_ptr<TestLicenseServerConfig> server_config_;
  // Process handle for the license server.
  base::ProcessHandle license_server_process_;

  DISALLOW_COPY_AND_ASSIGN(TestLicenseServer);
};

#endif  // CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_