| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/values.h" | 20 #include "base/values.h" |
| 20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/io_thread.h" | 22 #include "chrome/browser/io_thread.h" |
| 22 #include "chrome/browser/prerender/prerender_manager.h" | 23 #include "chrome/browser/prerender/prerender_manager.h" |
| 23 #include "chrome/browser/prerender/prerender_manager_factory.h" | 24 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 27 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 28 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 28 #include "chrome/common/channel_info.h" | 29 #include "chrome/common/channel_info.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 const base::ListValue* list_value) { | 284 const base::ListValue* list_value) { |
| 284 ASSERT_TRUE(incognito_browser_); | 285 ASSERT_TRUE(incognito_browser_); |
| 285 incognito_browser_->tab_strip_model()->CloseAllTabs(); | 286 incognito_browser_->tab_strip_model()->CloseAllTabs(); |
| 286 // Closing all a Browser's tabs will ultimately result in its destruction, | 287 // Closing all a Browser's tabs will ultimately result in its destruction, |
| 287 // thought it may not have been destroyed yet. | 288 // thought it may not have been destroyed yet. |
| 288 incognito_browser_ = NULL; | 289 incognito_browser_ = NULL; |
| 289 } | 290 } |
| 290 | 291 |
| 291 void NetInternalsTest::MessageHandler::GetNetLogFileContents( | 292 void NetInternalsTest::MessageHandler::GetNetLogFileContents( |
| 292 const base::ListValue* list_value) { | 293 const base::ListValue* list_value) { |
| 294 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 293 base::ScopedTempDir temp_directory; | 295 base::ScopedTempDir temp_directory; |
| 294 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 296 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
| 295 base::FilePath temp_file; | 297 base::FilePath temp_file; |
| 296 ASSERT_TRUE( | 298 ASSERT_TRUE( |
| 297 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); | 299 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); |
| 298 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); | 300 base::ScopedFILE temp_file_handle(base::OpenFile(temp_file, "w")); |
| 299 ASSERT_TRUE(temp_file_handle); | 301 ASSERT_TRUE(temp_file_handle); |
| 300 | 302 |
| 301 std::unique_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( | 303 std::unique_ptr<base::Value> constants(net_log::ChromeNetLog::GetConstants( |
| 302 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), | 304 base::CommandLine::ForCurrentProcess()->GetCommandLineString(), |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if (test_server_started_) | 379 if (test_server_started_) |
| 378 return true; | 380 return true; |
| 379 test_server_started_ = embedded_test_server()->Start(); | 381 test_server_started_ = embedded_test_server()->Start(); |
| 380 | 382 |
| 381 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 | 383 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 |
| 382 // are forbidden. | 384 // are forbidden. |
| 383 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); | 385 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); |
| 384 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); | 386 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); |
| 385 return test_server_started_; | 387 return test_server_started_; |
| 386 } | 388 } |
| OLD | NEW |