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 #include <map> | 5 #include <map> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 new net::HttpResponseHeaders( | 1266 new net::HttpResponseHeaders( |
1267 net::HttpUtil::AssembleRawHeaders( | 1267 net::HttpUtil::AssembleRawHeaders( |
1268 base_headers_string, sizeof(base_headers_string)))); | 1268 base_headers_string, sizeof(base_headers_string)))); |
1269 | 1269 |
1270 ResponseHeaders new_headers; | 1270 ResponseHeaders new_headers; |
1271 new_headers.push_back(ResponseHeader("kEy1", "Value1")); // Unchanged | 1271 new_headers.push_back(ResponseHeader("kEy1", "Value1")); // Unchanged |
1272 new_headers.push_back(ResponseHeader("Key2", "Value1")); // Modified | 1272 new_headers.push_back(ResponseHeader("Key2", "Value1")); // Modified |
1273 // Key3 is deleted | 1273 // Key3 is deleted |
1274 new_headers.push_back(ResponseHeader("Key4", "Value4")); // Added | 1274 new_headers.push_back(ResponseHeader("Key4", "Value4")); // Added |
1275 | 1275 |
1276 scoped_ptr<EventResponseDelta> delta( | 1276 scoped_ptr<EventResponseDelta> delta(CalculateOnHeadersReceivedDelta( |
1277 CalculateOnHeadersReceivedDelta("extid", base::Time::Now(), cancel, | 1277 "extid", base::Time::Now(), cancel, base_headers.get(), &new_headers)); |
1278 base_headers, &new_headers)); | |
1279 ASSERT_TRUE(delta.get()); | 1278 ASSERT_TRUE(delta.get()); |
1280 EXPECT_TRUE(delta->cancel); | 1279 EXPECT_TRUE(delta->cancel); |
1281 EXPECT_EQ(2u, delta->added_response_headers.size()); | 1280 EXPECT_EQ(2u, delta->added_response_headers.size()); |
1282 EXPECT_TRUE(Contains(delta->added_response_headers, | 1281 EXPECT_TRUE(Contains(delta->added_response_headers, |
1283 ResponseHeader("Key2", "Value1"))); | 1282 ResponseHeader("Key2", "Value1"))); |
1284 EXPECT_TRUE(Contains(delta->added_response_headers, | 1283 EXPECT_TRUE(Contains(delta->added_response_headers, |
1285 ResponseHeader("Key4", "Value4"))); | 1284 ResponseHeader("Key4", "Value4"))); |
1286 EXPECT_EQ(2u, delta->deleted_response_headers.size()); | 1285 EXPECT_EQ(2u, delta->deleted_response_headers.size()); |
1287 EXPECT_TRUE(Contains(delta->deleted_response_headers, | 1286 EXPECT_TRUE(Contains(delta->deleted_response_headers, |
1288 ResponseHeader("Key2", "Value2, Bar"))); | 1287 ResponseHeader("Key2", "Value2, Bar"))); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 EXPECT_TRUE(credentials_set); | 2133 EXPECT_TRUE(credentials_set); |
2135 EXPECT_FALSE(auth3.Empty()); | 2134 EXPECT_FALSE(auth3.Empty()); |
2136 EXPECT_EQ(username, auth1.username()); | 2135 EXPECT_EQ(username, auth1.username()); |
2137 EXPECT_EQ(password, auth1.password()); | 2136 EXPECT_EQ(password, auth1.password()); |
2138 EXPECT_EQ(1u, warning_set.size()); | 2137 EXPECT_EQ(1u, warning_set.size()); |
2139 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2138 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
2140 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2139 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
2141 } | 2140 } |
2142 | 2141 |
2143 } // namespace extensions | 2142 } // namespace extensions |
OLD | NEW |