| OLD | NEW |
| 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 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers_te
st_utils.h" |
| 9 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 10 #include "net/proxy/proxy_service.h" | 11 #include "net/proxy/proxy_service.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace { | |
| 14 | |
| 15 // Transform "normal"-looking headers (\n-separated) to the appropriate | |
| 16 // input format for ParseRawHeaders (\0-separated). | |
| 17 void HeadersToRaw(std::string* headers) { | |
| 18 std::replace(headers->begin(), headers->end(), '\n', '\0'); | |
| 19 if (!headers->empty()) | |
| 20 *headers += '\0'; | |
| 21 } | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 namespace data_reduction_proxy { | 14 namespace data_reduction_proxy { |
| 26 | 15 |
| 27 class DataReductionProxyHeadersTest : public testing::Test {}; | 16 class DataReductionProxyHeadersTest : public testing::Test {}; |
| 28 | 17 |
| 29 TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyActionValue) { | 18 TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyActionValue) { |
| 30 const struct { | 19 const struct { |
| 31 const char* headers; | 20 const char* headers; |
| 32 std::string action_key; | 21 std::string action_key; |
| 33 bool expected_result; | 22 bool expected_result; |
| 34 std::string expected_action_value; | 23 std::string expected_action_value; |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 std::string output_values_string; | 867 std::string output_values_string; |
| 879 for (size_t j = 0; j < output_values.size(); ++j) | 868 for (size_t j = 0; j < output_values.size(); ++j) |
| 880 output_values_string += output_values[j] + ","; | 869 output_values_string += output_values[j] + ","; |
| 881 | 870 |
| 882 EXPECT_EQ(test[i].expected_output_values_string, output_values_string) | 871 EXPECT_EQ(test[i].expected_output_values_string, output_values_string) |
| 883 << test[i].label; | 872 << test[i].label; |
| 884 } | 873 } |
| 885 } | 874 } |
| 886 | 875 |
| 887 } // namespace data_reduction_proxy | 876 } // namespace data_reduction_proxy |
| OLD | NEW |