OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/base/net_log_logger.h" | 5 #include "net/base/net_log_logger.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContextWithActiveRequest) { | 205 TEST_F(NetLogLoggerTest, GeneratesValidJSONWithContextWithActiveRequest) { |
206 // Create context, start a request. | 206 // Create context, start a request. |
207 TestURLRequestContext context(true); | 207 TestURLRequestContext context(true); |
208 context.set_net_log(&net_log_); | 208 context.set_net_log(&net_log_); |
209 context.Init(); | 209 context.Init(); |
210 TestDelegate delegate; | 210 TestDelegate delegate; |
211 | 211 |
212 // URL doesn't matter. Requests can't fail synchronously. | 212 // URL doesn't matter. Requests can't fail synchronously. |
213 scoped_ptr<URLRequest> request( | 213 scoped_ptr<URLRequest> request( |
214 context.CreateRequest(GURL("blah:blah"), IDLE, &delegate, nullptr)); | 214 context.CreateRequest(GURL("blah:blah"), IDLE, &delegate)); |
215 request->Start(); | 215 request->Start(); |
216 | 216 |
217 // Create and destroy a logger. | 217 // Create and destroy a logger. |
218 base::ScopedFILE file(base::OpenFile(log_path_, "w")); | 218 base::ScopedFILE file(base::OpenFile(log_path_, "w")); |
219 ASSERT_TRUE(file); | 219 ASSERT_TRUE(file); |
220 scoped_ptr<NetLogLogger> logger(new NetLogLogger()); | 220 scoped_ptr<NetLogLogger> logger(new NetLogLogger()); |
221 logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); | 221 logger->StartObserving(&net_log_, file.Pass(), nullptr, &context); |
222 logger->StopObserving(&context); | 222 logger->StopObserving(&context); |
223 logger.reset(); | 223 logger.reset(); |
224 | 224 |
(...skipping 11 matching lines...) Expand all Loading... |
236 ASSERT_EQ(1u, events->GetSize()); | 236 ASSERT_EQ(1u, events->GetSize()); |
237 | 237 |
238 // Make sure additional information is present, but don't validate it. | 238 // Make sure additional information is present, but don't validate it. |
239 base::DictionaryValue* tab_info; | 239 base::DictionaryValue* tab_info; |
240 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); | 240 ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info)); |
241 } | 241 } |
242 | 242 |
243 } // namespace | 243 } // namespace |
244 | 244 |
245 } // namespace net | 245 } // namespace net |
OLD | NEW |