OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "net/test/spawned_test_server/local_test_server.h" | 11 #include "net/test/spawned_test_server/local_test_server.h" |
12 | 12 |
| 13 namespace safe_browsing { |
| 14 |
13 // Runs a Python-based safebrowsing test server on the same machine in which the | 15 // Runs a Python-based safebrowsing test server on the same machine in which the |
14 // LocalSafeBrowsingTestServer runs. | 16 // LocalSafeBrowsingTestServer runs. |
15 class LocalSafeBrowsingTestServer : public net::LocalTestServer { | 17 class LocalSafeBrowsingTestServer : public net::LocalTestServer { |
16 public: | 18 public: |
17 // Initialize a safebrowsing server using the given |data_file|. | 19 // Initialize a safebrowsing server using the given |data_file|. |
18 explicit LocalSafeBrowsingTestServer(const base::FilePath& data_file); | 20 explicit LocalSafeBrowsingTestServer(const base::FilePath& data_file); |
19 | 21 |
20 ~LocalSafeBrowsingTestServer() override; | 22 ~LocalSafeBrowsingTestServer() override; |
21 | 23 |
22 bool SetPythonPath() const override; | 24 bool SetPythonPath() const override; |
23 | 25 |
24 // Returns the path to safe_browsing_testserver.py. | 26 // Returns the path to safe_browsing_testserver.py. |
25 bool GetTestServerPath(base::FilePath* testserver_path) const override; | 27 bool GetTestServerPath(base::FilePath* testserver_path) const override; |
26 | 28 |
27 protected: | 29 protected: |
28 // Adds the --data-file switch. Returns true on success. | 30 // Adds the --data-file switch. Returns true on success. |
29 bool GenerateAdditionalArguments( | 31 bool GenerateAdditionalArguments( |
30 base::DictionaryValue* arguments) const override; | 32 base::DictionaryValue* arguments) const override; |
31 | 33 |
32 private: | 34 private: |
33 base::FilePath data_file_; | 35 base::FilePath data_file_; |
34 | 36 |
35 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingTestServer); | 37 DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingTestServer); |
36 }; | 38 }; |
37 | 39 |
| 40 } // namespace safe_browsing |
| 41 |
38 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ | 42 #endif // CHROME_BROWSER_SAFE_BROWSING_LOCAL_SAFEBROWSING_TEST_SERVER_H_ |
OLD | NEW |