OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/base/filter.h" | 5 #include "net/base/filter.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 class FilterTest : public testing::Test { | 8 class FilterTest : public testing::Test { |
9 }; | 9 }; |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 TEST(FilterTest, MissingSdchEncoding) { | 116 TEST(FilterTest, MissingSdchEncoding) { |
117 // Handle interesting case where entire SDCH encoding assertion "got lost." | 117 // Handle interesting case where entire SDCH encoding assertion "got lost." |
118 const bool is_sdch_response = true; | 118 const bool is_sdch_response = true; |
119 const std::string kTextHtmlMime("text/html"); | 119 const std::string kTextHtmlMime("text/html"); |
120 std::vector<Filter::FilterType> encoding_types; | 120 std::vector<Filter::FilterType> encoding_types; |
121 | 121 |
122 // Loss of encoding, but it was an SDCH response with html type. | 122 // Loss of encoding, but it was an SDCH response with html type. |
123 encoding_types.clear(); | 123 encoding_types.clear(); |
124 Filter::FixupEncodingTypes(is_sdch_response, kTextHtmlMime, &encoding_types); | 124 Filter::FixupEncodingTypes(is_sdch_response, kTextHtmlMime, &encoding_types); |
125 EXPECT_EQ(2U, encoding_types.size()); | 125 EXPECT_EQ(2U, encoding_types.size()); |
126 EXPECT_EQ(Filter::FILTER_TYPE_SDCH, encoding_types[0]); | 126 EXPECT_EQ(Filter::FILTER_TYPE_SDCH_POSSIBLE, encoding_types[0]); |
127 EXPECT_EQ(Filter::FILTER_TYPE_GZIP_HELPING_SDCH, encoding_types[1]); | 127 EXPECT_EQ(Filter::FILTER_TYPE_GZIP_HELPING_SDCH, encoding_types[1]); |
128 | 128 |
129 // No encoding, but it was an SDCH response with non-html type. | 129 // No encoding, but it was an SDCH response with non-html type. |
130 encoding_types.clear(); | 130 encoding_types.clear(); |
131 Filter::FixupEncodingTypes(is_sdch_response, "other/mime", &encoding_types); | 131 Filter::FixupEncodingTypes(is_sdch_response, "other/mime", &encoding_types); |
132 EXPECT_TRUE(encoding_types.empty()); | 132 EXPECT_TRUE(encoding_types.empty()); |
133 } | 133 } |
OLD | NEW |