| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/browser/web_ui_message_handler.h" | 36 #include "content/public/browser/web_ui_message_handler.h" |
| 37 #include "net/base/address_list.h" | 37 #include "net/base/address_list.h" |
| 38 #include "net/base/net_errors.h" | 38 #include "net/base/net_errors.h" |
| 39 #include "net/dns/host_cache.h" | 39 #include "net/dns/host_cache.h" |
| 40 #include "net/dns/host_resolver.h" | 40 #include "net/dns/host_resolver.h" |
| 41 #include "net/dns/mock_host_resolver.h" | 41 #include "net/dns/mock_host_resolver.h" |
| 42 #include "net/http/http_network_session.h" | 42 #include "net/http/http_network_session.h" |
| 43 #include "net/http/http_transaction_factory.h" | 43 #include "net/http/http_transaction_factory.h" |
| 44 #include "net/log/net_log.h" | 44 #include "net/log/net_log.h" |
| 45 #include "net/log/net_log_event_type.h" |
| 46 #include "net/log/net_log_source_type.h" |
| 45 #include "net/log/write_to_file_net_log_observer.h" | 47 #include "net/log/write_to_file_net_log_observer.h" |
| 46 #include "net/test/embedded_test_server/embedded_test_server.h" | 48 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 47 #include "net/test/embedded_test_server/request_handler_util.h" | 49 #include "net/test/embedded_test_server/request_handler_util.h" |
| 48 #include "net/url_request/url_request_context.h" | 50 #include "net/url_request/url_request_context.h" |
| 49 #include "net/url_request/url_request_context_getter.h" | 51 #include "net/url_request/url_request_context_getter.h" |
| 50 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
| 51 #include "url/gurl.h" | 53 #include "url/gurl.h" |
| 52 | 54 |
| 53 using content::BrowserThread; | 55 using content::BrowserThread; |
| 54 using content::WebUIMessageHandler; | 56 using content::WebUIMessageHandler; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 286 |
| 285 std::unique_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( | 287 std::unique_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( |
| 286 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), | 288 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), |
| 287 chrome::GetChannelString())); | 289 chrome::GetChannelString())); |
| 288 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_logger( | 290 std::unique_ptr<net::WriteToFileNetLogObserver> net_log_logger( |
| 289 new net::WriteToFileNetLogObserver()); | 291 new net::WriteToFileNetLogObserver()); |
| 290 net_log_logger->StartObserving(g_browser_process->net_log(), | 292 net_log_logger->StartObserving(g_browser_process->net_log(), |
| 291 std::move(temp_file_handle), constants.get(), | 293 std::move(temp_file_handle), constants.get(), |
| 292 nullptr); | 294 nullptr); |
| 293 g_browser_process->net_log()->AddGlobalEntry( | 295 g_browser_process->net_log()->AddGlobalEntry( |
| 294 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); | 296 net::NetLogEventType::NETWORK_IP_ADDRESSES_CHANGED); |
| 295 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( | 297 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( |
| 296 g_browser_process->net_log(), | 298 g_browser_process->net_log(), |
| 297 net::NetLog::SOURCE_URL_REQUEST); | 299 net::NetLogSourceType::URL_REQUEST); |
| 298 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); | 300 bound_net_log.BeginEvent(net::NetLogEventType::REQUEST_ALIVE); |
| 299 net_log_logger->StopObserving(nullptr); | 301 net_log_logger->StopObserving(nullptr); |
| 300 net_log_logger.reset(); | 302 net_log_logger.reset(); |
| 301 | 303 |
| 302 std::string log_contents; | 304 std::string log_contents; |
| 303 ASSERT_TRUE(base::ReadFileToString(temp_file, &log_contents)); | 305 ASSERT_TRUE(base::ReadFileToString(temp_file, &log_contents)); |
| 304 ASSERT_GT(log_contents.length(), 0u); | 306 ASSERT_GT(log_contents.length(), 0u); |
| 305 | 307 |
| 306 std::unique_ptr<base::Value> log_contents_value( | 308 std::unique_ptr<base::Value> log_contents_value( |
| 307 new base::StringValue(log_contents)); | 309 new base::StringValue(log_contents)); |
| 308 RunJavascriptCallback(log_contents_value.get()); | 310 RunJavascriptCallback(log_contents_value.get()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (test_server_started_) | 368 if (test_server_started_) |
| 367 return true; | 369 return true; |
| 368 test_server_started_ = embedded_test_server()->Start(); | 370 test_server_started_ = embedded_test_server()->Start(); |
| 369 | 371 |
| 370 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 | 372 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 |
| 371 // are forbidden. | 373 // are forbidden. |
| 372 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); | 374 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); |
| 373 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); | 375 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); |
| 374 return test_server_started_; | 376 return test_server_started_; |
| 375 } | 377 } |
| OLD | NEW |