| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "net/base/auth.h" | 8 #include "net/base/auth.h" |
| 9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
| 10 #include "net/http/http_network_session_peer.h" | 10 #include "net/http/http_network_session_peer.h" |
| (...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3336 helper.RunToCompletion(data.get()); | 3336 helper.RunToCompletion(data.get()); |
| 3337 TransactionHelperResult out = helper.output(); | 3337 TransactionHelperResult out = helper.output(); |
| 3338 EXPECT_EQ(OK, out.rv); | 3338 EXPECT_EQ(OK, out.rv); |
| 3339 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 3339 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
| 3340 EXPECT_EQ("hello!", out.response_data); | 3340 EXPECT_EQ("hello!", out.response_data); |
| 3341 | 3341 |
| 3342 // Check that the NetLog was filled reasonably. | 3342 // Check that the NetLog was filled reasonably. |
| 3343 // This test is intentionally non-specific about the exact ordering of the | 3343 // This test is intentionally non-specific about the exact ordering of the |
| 3344 // log; instead we just check to make sure that certain events exist, and that | 3344 // log; instead we just check to make sure that certain events exist, and that |
| 3345 // they are in the right order. | 3345 // they are in the right order. |
| 3346 EXPECT_LT(0u, log.entries().size()); | 3346 net::CapturingNetLog::EntryList entries; |
| 3347 log.GetEntries(&entries); |
| 3348 |
| 3349 EXPECT_LT(0u, entries.size()); |
| 3347 int pos = 0; | 3350 int pos = 0; |
| 3348 pos = net::ExpectLogContainsSomewhere(log.entries(), 0, | 3351 pos = net::ExpectLogContainsSomewhere(entries, 0, |
| 3349 net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, | 3352 net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, |
| 3350 net::NetLog::PHASE_BEGIN); | 3353 net::NetLog::PHASE_BEGIN); |
| 3351 pos = net::ExpectLogContainsSomewhere(log.entries(), pos + 1, | 3354 pos = net::ExpectLogContainsSomewhere(entries, pos + 1, |
| 3352 net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, | 3355 net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST, |
| 3353 net::NetLog::PHASE_END); | 3356 net::NetLog::PHASE_END); |
| 3354 pos = net::ExpectLogContainsSomewhere(log.entries(), pos + 1, | 3357 pos = net::ExpectLogContainsSomewhere(entries, pos + 1, |
| 3355 net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, | 3358 net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, |
| 3356 net::NetLog::PHASE_BEGIN); | 3359 net::NetLog::PHASE_BEGIN); |
| 3357 pos = net::ExpectLogContainsSomewhere(log.entries(), pos + 1, | 3360 pos = net::ExpectLogContainsSomewhere(entries, pos + 1, |
| 3358 net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, | 3361 net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS, |
| 3359 net::NetLog::PHASE_END); | 3362 net::NetLog::PHASE_END); |
| 3360 pos = net::ExpectLogContainsSomewhere(log.entries(), pos + 1, | 3363 pos = net::ExpectLogContainsSomewhere(entries, pos + 1, |
| 3361 net::NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, | 3364 net::NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, |
| 3362 net::NetLog::PHASE_BEGIN); | 3365 net::NetLog::PHASE_BEGIN); |
| 3363 pos = net::ExpectLogContainsSomewhere(log.entries(), pos + 1, | 3366 pos = net::ExpectLogContainsSomewhere(entries, pos + 1, |
| 3364 net::NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, | 3367 net::NetLog::TYPE_HTTP_TRANSACTION_READ_BODY, |
| 3365 net::NetLog::PHASE_END); | 3368 net::NetLog::PHASE_END); |
| 3366 | 3369 |
| 3367 // Check that we logged all the headers correctly | 3370 // Check that we logged all the headers correctly |
| 3368 pos = net::ExpectLogContainsSomewhere( | 3371 pos = net::ExpectLogContainsSomewhere( |
| 3369 log.entries(), 0, | 3372 entries, 0, |
| 3370 net::NetLog::TYPE_SPDY_SESSION_SYN_STREAM, | 3373 net::NetLog::TYPE_SPDY_SESSION_SYN_STREAM, |
| 3371 net::NetLog::PHASE_NONE); | 3374 net::NetLog::PHASE_NONE); |
| 3372 CapturingNetLog::Entry entry = log.entries()[pos]; | 3375 CapturingNetLog::Entry entry = entries[pos]; |
| 3373 NetLogSpdySynParameter* request_params = | 3376 NetLogSpdySynParameter* request_params = |
| 3374 static_cast<NetLogSpdySynParameter*>(entry.extra_parameters.get()); | 3377 static_cast<NetLogSpdySynParameter*>(entry.extra_parameters.get()); |
| 3375 spdy::SpdyHeaderBlock* headers = | 3378 spdy::SpdyHeaderBlock* headers = |
| 3376 request_params->GetHeaders().get(); | 3379 request_params->GetHeaders().get(); |
| 3377 | 3380 |
| 3378 spdy::SpdyHeaderBlock expected; | 3381 spdy::SpdyHeaderBlock expected; |
| 3379 expected["host"] = "www.google.com"; | 3382 expected["host"] = "www.google.com"; |
| 3380 expected["url"] = "/"; | 3383 expected["url"] = "/"; |
| 3381 expected["scheme"] = "http"; | 3384 expected["scheme"] = "http"; |
| 3382 expected["version"] = "HTTP/1.1"; | 3385 expected["version"] = "HTTP/1.1"; |
| (...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4668 // TODO(cbentzel): This is actually the same response object as before, but | 4671 // TODO(cbentzel): This is actually the same response object as before, but |
| 4669 // data has changed. | 4672 // data has changed. |
| 4670 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); | 4673 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); |
| 4671 ASSERT_TRUE(response_restart != NULL); | 4674 ASSERT_TRUE(response_restart != NULL); |
| 4672 ASSERT_TRUE(response_restart->headers != NULL); | 4675 ASSERT_TRUE(response_restart->headers != NULL); |
| 4673 EXPECT_EQ(200, response_restart->headers->response_code()); | 4676 EXPECT_EQ(200, response_restart->headers->response_code()); |
| 4674 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); | 4677 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); |
| 4675 } | 4678 } |
| 4676 | 4679 |
| 4677 } // namespace net | 4680 } // namespace net |
| OLD | NEW |