OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ |
6 #define CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ | 6 #define CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 LocalPolicyTestServer(); | 29 LocalPolicyTestServer(); |
30 | 30 |
31 // Initializes a test server configured by the configuration file | 31 // Initializes a test server configured by the configuration file |
32 // |config_file|. | 32 // |config_file|. |
33 explicit LocalPolicyTestServer(const base::FilePath& config_file); | 33 explicit LocalPolicyTestServer(const base::FilePath& config_file); |
34 | 34 |
35 // Initializes the test server with the configuration read from | 35 // Initializes the test server with the configuration read from |
36 // chrome/test/data/policy/policy_|test_name|.json. | 36 // chrome/test/data/policy/policy_|test_name|.json. |
37 explicit LocalPolicyTestServer(const std::string& test_name); | 37 explicit LocalPolicyTestServer(const std::string& test_name); |
38 | 38 |
39 virtual ~LocalPolicyTestServer(); | 39 ~LocalPolicyTestServer() override; |
40 | 40 |
41 // Sets the policy signing key and verification signature used by the server. | 41 // Sets the policy signing key and verification signature used by the server. |
42 // This must be called before starting the server, and only works when the | 42 // This must be called before starting the server, and only works when the |
43 // server serves from a temporary directory. | 43 // server serves from a temporary directory. |
44 bool SetSigningKeyAndSignature(const crypto::RSAPrivateKey* key, | 44 bool SetSigningKeyAndSignature(const crypto::RSAPrivateKey* key, |
45 const std::string& signature); | 45 const std::string& signature); |
46 | 46 |
47 // Pre-configures a registered client so the server returns policy without the | 47 // Pre-configures a registered client so the server returns policy without the |
48 // client having to make a registration call. This must be called before | 48 // client having to make a registration call. This must be called before |
49 // starting the server, and only works when the server serves from a temporary | 49 // starting the server, and only works when the server serves from a temporary |
(...skipping 23 matching lines...) Expand all Loading... |
73 // | 73 // |
74 // This only works when the server serves from a temporary directory. | 74 // This only works when the server serves from a temporary directory. |
75 bool UpdatePolicyData(const std::string& type, | 75 bool UpdatePolicyData(const std::string& type, |
76 const std::string& entity_id, | 76 const std::string& entity_id, |
77 const std::string& data); | 77 const std::string& data); |
78 | 78 |
79 // Gets the service URL. | 79 // Gets the service URL. |
80 GURL GetServiceURL() const; | 80 GURL GetServiceURL() const; |
81 | 81 |
82 // net::LocalTestServer: | 82 // net::LocalTestServer: |
83 virtual bool SetPythonPath() const override; | 83 bool SetPythonPath() const override; |
84 virtual bool GetTestServerPath( | 84 bool GetTestServerPath(base::FilePath* testserver_path) const override; |
85 base::FilePath* testserver_path) const override; | 85 bool GenerateAdditionalArguments( |
86 virtual bool GenerateAdditionalArguments( | |
87 base::DictionaryValue* arguments) const override; | 86 base::DictionaryValue* arguments) const override; |
88 | 87 |
89 private: | 88 private: |
90 std::string GetSelector(const std::string& type, | 89 std::string GetSelector(const std::string& type, |
91 const std::string& entity_id); | 90 const std::string& entity_id); |
92 | 91 |
93 base::FilePath config_file_; | 92 base::FilePath config_file_; |
94 base::FilePath policy_key_; | 93 base::FilePath policy_key_; |
95 base::DictionaryValue clients_; | 94 base::DictionaryValue clients_; |
96 base::ScopedTempDir server_data_dir_; | 95 base::ScopedTempDir server_data_dir_; |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(LocalPolicyTestServer); | 97 DISALLOW_COPY_AND_ASSIGN(LocalPolicyTestServer); |
99 }; | 98 }; |
100 | 99 |
101 } // namespace policy | 100 } // namespace policy |
102 | 101 |
103 #endif // CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ | 102 #endif // CHROME_BROWSER_POLICY_TEST_LOCAL_POLICY_TEST_SERVER_H_ |
OLD | NEW |