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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "content/public/browser/web_ui_message_handler.h" | 31 #include "content/public/browser/web_ui_message_handler.h" |
32 #include "net/base/address_list.h" | 32 #include "net/base/address_list.h" |
33 #include "net/base/net_errors.h" | 33 #include "net/base/net_errors.h" |
34 #include "net/dns/host_cache.h" | 34 #include "net/dns/host_cache.h" |
35 #include "net/dns/host_resolver.h" | 35 #include "net/dns/host_resolver.h" |
36 #include "net/dns/mock_host_resolver.h" | 36 #include "net/dns/mock_host_resolver.h" |
37 #include "net/http/http_network_session.h" | 37 #include "net/http/http_network_session.h" |
38 #include "net/http/http_transaction_factory.h" | 38 #include "net/http/http_transaction_factory.h" |
39 #include "net/log/net_log.h" | 39 #include "net/log/net_log.h" |
40 #include "net/log/net_log_logger.h" | 40 #include "net/log/write_to_file_net_log_observer.h" |
41 #include "net/url_request/url_request_context.h" | 41 #include "net/url_request/url_request_context.h" |
42 #include "net/url_request/url_request_context_getter.h" | 42 #include "net/url_request/url_request_context_getter.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "url/gurl.h" | 44 #include "url/gurl.h" |
45 | 45 |
46 using content::BrowserThread; | 46 using content::BrowserThread; |
47 using content::WebUIMessageHandler; | 47 using content::WebUIMessageHandler; |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 const base::ListValue* list_value) { | 275 const base::ListValue* list_value) { |
276 base::ScopedTempDir temp_directory; | 276 base::ScopedTempDir temp_directory; |
277 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 277 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
278 base::FilePath temp_file; | 278 base::FilePath temp_file; |
279 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), | 279 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), |
280 &temp_file)); | 280 &temp_file)); |
281 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); | 281 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); |
282 ASSERT_TRUE(temp_file_handle); | 282 ASSERT_TRUE(temp_file_handle); |
283 | 283 |
284 scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); | 284 scoped_ptr<base::Value> constants(NetInternalsUI::GetConstants()); |
285 scoped_ptr<net::NetLogLogger> net_log_logger(new net::NetLogLogger()); | 285 scoped_ptr<net::WriteToFileNetLogObserver> net_log_logger( |
| 286 new net::WriteToFileNetLogObserver()); |
286 net_log_logger->StartObserving( | 287 net_log_logger->StartObserving( |
287 g_browser_process->net_log(), temp_file_handle.Pass(), constants.get(), | 288 g_browser_process->net_log(), temp_file_handle.Pass(), constants.get(), |
288 nullptr); | 289 nullptr); |
289 g_browser_process->net_log()->AddGlobalEntry( | 290 g_browser_process->net_log()->AddGlobalEntry( |
290 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); | 291 net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); |
291 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( | 292 net::BoundNetLog bound_net_log = net::BoundNetLog::Make( |
292 g_browser_process->net_log(), | 293 g_browser_process->net_log(), |
293 net::NetLog::SOURCE_URL_REQUEST); | 294 net::NetLog::SOURCE_URL_REQUEST); |
294 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); | 295 bound_net_log.BeginEvent(net::NetLog::TYPE_REQUEST_ALIVE); |
295 net_log_logger->StopObserving(nullptr); | 296 net_log_logger->StopObserving(nullptr); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if (test_server_started_) | 365 if (test_server_started_) |
365 return true; | 366 return true; |
366 test_server_started_ = test_server()->Start(); | 367 test_server_started_ = test_server()->Start(); |
367 | 368 |
368 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 | 369 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 |
369 // are forbidden. | 370 // are forbidden. |
370 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); | 371 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); |
371 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); | 372 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); |
372 return test_server_started_; | 373 return test_server_started_; |
373 } | 374 } |
OLD | NEW |