| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <arpa/inet.h> | 5 #include <arpa/inet.h> |
| 6 #include <netinet/tcp.h> | 6 #include <netinet/tcp.h> |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 EXPECT_TRUE(memcmp(reply_buffer->data(), "goodbye!", 8) == 0); | 227 EXPECT_TRUE(memcmp(reply_buffer->data(), "goodbye!", 8) == 0); |
| 228 | 228 |
| 229 next_proto_status_ = sock->GetNextProto(&next_proto_); | 229 next_proto_status_ = sock->GetNextProto(&next_proto_); |
| 230 | 230 |
| 231 sock->Disconnect(); | 231 sock->Disconnect(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // SnapStartEventType extracts the type of Snap Start from the NetLog. See | 234 // SnapStartEventType extracts the type of Snap Start from the NetLog. See |
| 235 // the SSL_SNAP_START_* defines in sslt.h | 235 // the SSL_SNAP_START_* defines in sslt.h |
| 236 int SnapStartEventType() { | 236 int SnapStartEventType() { |
| 237 const std::vector<CapturingNetLog::Entry>& entries = log_.entries(); | 237 CapturingNetLog::EntryList entries; |
| 238 for (std::vector<CapturingNetLog::Entry>::const_iterator | 238 log_.GetEntries(&entries); |
| 239 for (CapturingNetLog::EntryList::const_iterator |
| 239 i = entries.begin(); i != entries.end(); i++) { | 240 i = entries.begin(); i != entries.end(); i++) { |
| 240 if (i->type == NetLog::TYPE_SSL_SNAP_START) { | 241 if (i->type == NetLog::TYPE_SSL_SNAP_START) { |
| 241 scoped_ptr<Value> value(i->extra_parameters->ToValue()); | 242 scoped_ptr<Value> value(i->extra_parameters->ToValue()); |
| 242 CHECK(value->GetType() == Value::TYPE_DICTIONARY); | 243 CHECK(value->GetType() == Value::TYPE_DICTIONARY); |
| 243 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(value.get()); | 244 DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(value.get()); |
| 244 int ret; | 245 int ret; |
| 245 CHECK(dict->GetInteger("type", &ret)); | 246 CHECK(dict->GetInteger("type", &ret)); |
| 246 return ret; | 247 return ret; |
| 247 } | 248 } |
| 248 } | 249 } |
| 249 return -1; | 250 return -1; |
| 250 } | 251 } |
| 251 | 252 |
| 252 // DidMerge returns true if the NetLog suggests the the SSL connection merged | 253 // DidMerge returns true if the NetLog suggests the the SSL connection merged |
| 253 // it's certificate validation with the optimistic validation from the | 254 // it's certificate validation with the optimistic validation from the |
| 254 // SSLHostInfo. | 255 // SSLHostInfo. |
| 255 bool DidMerge() { | 256 bool DidMerge() { |
| 256 const std::vector<CapturingNetLog::Entry>& entries = log_.entries(); | 257 CapturingNetLog::EntryList entries; |
| 257 for (std::vector<CapturingNetLog::Entry>::const_iterator | 258 log_.GetEntries(&entries); |
| 259 for (CapturingNetLog::EntryList::const_iterator |
| 258 i = entries.begin(); i != entries.end(); i++) { | 260 i = entries.begin(); i != entries.end(); i++) { |
| 259 if (i->type == NetLog::TYPE_SSL_VERIFICATION_MERGED) | 261 if (i->type == NetLog::TYPE_SSL_VERIFICATION_MERGED) |
| 260 return true; | 262 return true; |
| 261 } | 263 } |
| 262 return false; | 264 return false; |
| 263 } | 265 } |
| 264 | 266 |
| 265 base::ProcessHandle child_; | 267 base::ProcessHandle child_; |
| 266 ClientSocketFactory* const socket_factory_; | 268 ClientSocketFactory* const socket_factory_; |
| 267 struct sockaddr_in remote_; | 269 struct sockaddr_in remote_; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 359 |
| 358 SSLClientSocketNSS::ClearSessionCache(); | 360 SSLClientSocketNSS::ClearSessionCache(); |
| 359 PerformConnection(); | 361 PerformConnection(); |
| 360 EXPECT_EQ(SSL_SNAP_START_FULL, SnapStartEventType()); | 362 EXPECT_EQ(SSL_SNAP_START_FULL, SnapStartEventType()); |
| 361 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, next_proto_status_); | 363 EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, next_proto_status_); |
| 362 EXPECT_EQ("baz", next_proto_); | 364 EXPECT_EQ("baz", next_proto_); |
| 363 EXPECT_TRUE(DidMerge()); | 365 EXPECT_TRUE(DidMerge()); |
| 364 } | 366 } |
| 365 | 367 |
| 366 } // namespace net | 368 } // namespace net |
| OLD | NEW |