OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "net/base/load_log.h" | |
10 #include "net/base/load_log_unittest.h" | |
11 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
| 10 #include "net/base/net_log.h" |
| 11 #include "net/base/net_log_unittest.h" |
12 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
13 #include "net/socket/socket_test_util.h" | 13 #include "net/socket/socket_test_util.h" |
14 #include "net/socket_stream/socket_stream.h" | 14 #include "net/socket_stream/socket_stream.h" |
15 #include "net/url_request/url_request_unittest.h" | 15 #include "net/url_request/url_request_unittest.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
18 | 18 |
19 struct SocketStreamEvent { | 19 struct SocketStreamEvent { |
20 enum EventType { | 20 enum EventType { |
21 EVENT_CONNECTED, EVENT_SENT_DATA, EVENT_RECEIVED_DATA, EVENT_CLOSE, | 21 EVENT_CONNECTED, EVENT_SENT_DATA, EVENT_RECEIVED_DATA, EVENT_CLOSE, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 callback.WaitForResult(); | 205 callback.WaitForResult(); |
206 | 206 |
207 const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); | 207 const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); |
208 EXPECT_EQ(3U, events.size()); | 208 EXPECT_EQ(3U, events.size()); |
209 | 209 |
210 EXPECT_EQ(SocketStreamEvent::EVENT_AUTH_REQUIRED, events[0].event_type); | 210 EXPECT_EQ(SocketStreamEvent::EVENT_AUTH_REQUIRED, events[0].event_type); |
211 EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[1].event_type); | 211 EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[1].event_type); |
212 EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[2].event_type); | 212 EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[2].event_type); |
213 | 213 |
214 // The first and last entries of the LoadLog should be for | 214 // TODO(eroman): Add back NetLogTest here... |
215 // SOCKET_STREAM_CONNECT. | |
216 EXPECT_TRUE(LogContainsBeginEvent( | |
217 *socket_stream->load_log(), 0, LoadLog::TYPE_SOCKET_STREAM_CONNECT)); | |
218 EXPECT_TRUE(LogContainsEndEvent( | |
219 *socket_stream->load_log(), -1, LoadLog::TYPE_SOCKET_STREAM_CONNECT)); | |
220 } | 215 } |
221 | 216 |
222 } // namespace net | 217 } // namespace net |
OLD | NEW |