Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h

Issue 2922663002: Data Reduction Proxy: Remove duplicate functions (Closed)
Patch Set: megjablon comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS _TEST_UTILS_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS _TEST_UTILS_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS _TEST_UTILS_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PARAMS _TEST_UTILS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 10 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
11 11
12 namespace data_reduction_proxy { 12 namespace data_reduction_proxy {
13 13
14 class DataReductionProxyServer; 14 class DataReductionProxyServer;
15 15
16 class TestDataReductionProxyParams : public DataReductionProxyParams { 16 class TestDataReductionProxyParams : public DataReductionProxyParams {
17 public: 17 public:
18 // Used to emulate having constants defined by the preprocessor. 18 TestDataReductionProxyParams();
19 enum HasNames {
20 HAS_NOTHING = 0x0,
21 HAS_ORIGIN = 0x2,
22 HAS_FALLBACK_ORIGIN = 0x4,
23 HAS_SECURE_PROXY_CHECK_URL = 0x40,
24 HAS_EVERYTHING = 0xff,
25 };
26
27 TestDataReductionProxyParams(int flags,
28 unsigned int has_definitions);
29 bool init_result() const; 19 bool init_result() const;
30 20
31 void SetProxiesForHttp(const std::vector<DataReductionProxyServer>& proxies); 21 void SetProxiesForHttp(const std::vector<DataReductionProxyServer>& proxies);
32 22
33 // Test values to replace the values specified in preprocessor defines. 23 // Test values to replace the values specified in preprocessor defines.
34 static std::string DefaultOrigin(); 24 static std::string DefaultOrigin();
35 static std::string DefaultFallbackOrigin(); 25 static std::string DefaultFallbackOrigin();
36 static std::string DefaultSecureProxyCheckURL(); 26 static std::string DefaultSecureProxyCheckURL();
37 27
38 static std::string FlagOrigin(); 28 static std::string FlagOrigin();
39 static std::string FlagFallbackOrigin(); 29 static std::string FlagFallbackOrigin();
40 static std::string FlagSecureProxyCheckURL(); 30 static std::string FlagSecureProxyCheckURL();
41 31
42 protected: 32 protected:
43 std::string GetDefaultOrigin() const override; 33 std::string GetDefaultOrigin() const override;
44 34
45 std::string GetDefaultFallbackOrigin() const override; 35 std::string GetDefaultFallbackOrigin() const override;
46 36
47 std::string GetDefaultSecureProxyCheckURL() const override; 37 std::string GetDefaultSecureProxyCheckURL() const override;
48 38
49 private: 39 private:
50 std::string GetDefinition(unsigned int has_def,
51 const std::string& definition) const;
52
53 unsigned int has_definitions_;
54 bool init_result_; 40 bool init_result_;
55 }; 41 };
56 } // namespace data_reduction_proxy 42 } // namespace data_reduction_proxy
57 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PAR AMS_TEST_UTILS_H_ 43 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PAR AMS_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698