OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/net_internals/net_internals_ui_browsertest.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
12 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
16 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), | 286 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), |
285 &temp_file)); | 287 &temp_file)); |
286 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); | 288 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); |
287 ASSERT_TRUE(temp_file_handle); | 289 ASSERT_TRUE(temp_file_handle); |
288 | 290 |
289 scoped_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( | 291 scoped_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( |
290 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), | 292 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), |
291 chrome::GetChannelString())); | 293 chrome::GetChannelString())); |
292 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger( | 294 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger( |
293 new net::WriteToFileNetLogObserver()); | 295 new net::WriteToFileNetLogObserver()); |
294 net_log_logger->StartObserving( | 296 net_log_logger->StartObserving(g_browser_process->net_log(), |
295 g_browser_process->net_log(), temp_file_handle.Pass(), constants.get(), | 297 std::move(temp_file_handle), constants.get(), |
296 nullptr); | 298 nullptr); |
297 g_browser_process->net_log()->AddGlobalEntry( | 299 g_browser_process->net_log()->AddGlobalEntry( |
298 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); | 300 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); |
299 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( | 301 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( |
300 g_browser_process->net_log(), | 302 g_browser_process->net_log(), |
301 net::NetLog::SOURCE_URL_REQUEST); | 303 net::NetLog::SOURCE_URL_REQUEST); |
302 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); | 304 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); |
303 net_log_logger->StopObserving(nullptr); | 305 net_log_logger->StopObserving(nullptr); |
304 net_log_logger.reset(); | 306 net_log_logger.reset(); |
305 | 307 |
306 std::string log_contents; | 308 std::string log_contents; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 if (test_server_started_) | 372 if (test_server_started_) |
371 return true; | 373 return true; |
372 test_server_started_ = embedded_test_server()->Start(); | 374 test_server_started_ = embedded_test_server()->Start(); |
373 | 375 |
374 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 | 376 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 |
375 // are forbidden. | 377 // are forbidden. |
376 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); | 378 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); |
377 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); | 379 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); |
378 return test_server_started_; | 380 return test_server_started_; |
379 } | 381 } |
OLD | NEW |