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 "chrome/browser/net/load_timing_observer.h" | 5 #include "chrome/browser/net/load_timing_observer.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 AddStartEntry(observer, source, NetLog::TYPE_SOCKET_ALIVE, NULL); | 74 AddStartEntry(observer, source, NetLog::TYPE_SOCKET_ALIVE, NULL); |
75 } | 75 } |
76 | 76 |
77 void AddEndSocketEntries(LoadTimingObserver& observer, uint32 id) { | 77 void AddEndSocketEntries(LoadTimingObserver& observer, uint32 id) { |
78 NetLog::Source source(NetLog::SOURCE_SOCKET, id); | 78 NetLog::Source source(NetLog::SOURCE_SOCKET, id); |
79 AddEndEntry(observer, source, NetLog::TYPE_SOCKET_ALIVE, NULL); | 79 AddEndEntry(observer, source, NetLog::TYPE_SOCKET_ALIVE, NULL); |
80 } | 80 } |
81 | 81 |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 // Test that URLRequest with no load timing flag is not processed. | 84 // Test that net::URLRequest with no load timing flag is not processed. |
85 TEST(LoadTimingObserverTest, NoLoadTimingEnabled) { | 85 TEST(LoadTimingObserverTest, NoLoadTimingEnabled) { |
86 LoadTimingObserver observer; | 86 LoadTimingObserver observer; |
87 | 87 |
88 AddStartURLRequestEntries(observer, 0, false); | 88 AddStartURLRequestEntries(observer, 0, false); |
89 LoadTimingObserver::URLRequestRecord* record = | 89 LoadTimingObserver::URLRequestRecord* record = |
90 observer.GetURLRequestRecord(0); | 90 observer.GetURLRequestRecord(0); |
91 ASSERT_TRUE(record == NULL); | 91 ASSERT_TRUE(record == NULL); |
92 } | 92 } |
93 | 93 |
94 // Test that URLRequestRecord is created, deleted and is not growing unbound. | 94 // Test that URLRequestRecord is created, deleted and is not growing unbound. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 AddStartEntry(observer, | 313 AddStartEntry(observer, |
314 source, | 314 source, |
315 NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET, | 315 NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET, |
316 params.get()); | 316 params.get()); |
317 | 317 |
318 LoadTimingObserver::URLRequestRecord* record = | 318 LoadTimingObserver::URLRequestRecord* record = |
319 observer.GetURLRequestRecord(0); | 319 observer.GetURLRequestRecord(0); |
320 ASSERT_EQ(1000, record->timing.ssl_start); | 320 ASSERT_EQ(1000, record->timing.ssl_start); |
321 ASSERT_EQ(3000, record->timing.ssl_end); | 321 ASSERT_EQ(3000, record->timing.ssl_end); |
322 } | 322 } |
OLD | NEW |