| 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/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/prerender/prerender_manager.h" | 13 #include "chrome/browser/prerender/prerender_manager.h" |
| 14 #include "chrome/browser/prerender/prerender_manager_factory.h" | 14 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/browser/web_ui_message_handler.h" | 23 #include "content/public/browser/web_ui_message_handler.h" |
| 23 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 24 #include "net/base/address_list.h" | 25 #include "net/base/address_list.h" |
| 25 #include "net/base/host_cache.h" | 26 #include "net/base/host_cache.h" |
| 26 #include "net/base/host_resolver.h" | 27 #include "net/base/host_resolver.h" |
| 27 #include "net/base/host_resolver_proc.h" | 28 #include "net/base/host_resolver_proc.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 338 } |
| 338 | 339 |
| 339 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) { | 340 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) { |
| 340 WebUIBrowserTest::SetUpCommandLine(command_line); | 341 WebUIBrowserTest::SetUpCommandLine(command_line); |
| 341 // Needed to test the prerender view. | 342 // Needed to test the prerender view. |
| 342 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 343 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
| 343 switches::kPrerenderModeSwitchValueEnabled); | 344 switches::kPrerenderModeSwitchValueEnabled); |
| 344 } | 345 } |
| 345 | 346 |
| 346 void NetInternalsTest::SetUpOnMainThread() { | 347 void NetInternalsTest::SetUpOnMainThread() { |
| 347 WebUIBrowserTest::SetUpOnMainThread(); | |
| 348 // Increase the memory allowed in a prerendered page above normal settings, | 348 // Increase the memory allowed in a prerendered page above normal settings, |
| 349 // as debug builds use more memory and often go over the usual limit. | 349 // as debug builds use more memory and often go over the usual limit. |
| 350 Profile* profile = browser()->profile(); | 350 Profile* profile = browser()->profile(); |
| 351 prerender::PrerenderManager* prerender_manager = | 351 prerender::PrerenderManager* prerender_manager = |
| 352 prerender::PrerenderManagerFactory::GetForProfile(profile); | 352 prerender::PrerenderManagerFactory::GetForProfile(profile); |
| 353 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; | 353 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; |
| 354 } | 354 } |
| 355 | 355 |
| 356 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { | 356 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { |
| 357 return message_handler_.get(); | 357 return message_handler_.get(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 373 GURL url_loader = test_server()->GetURL(replacement_path); | 373 GURL url_loader = test_server()->GetURL(replacement_path); |
| 374 return url_loader; | 374 return url_loader; |
| 375 } | 375 } |
| 376 | 376 |
| 377 bool NetInternalsTest::StartTestServer() { | 377 bool NetInternalsTest::StartTestServer() { |
| 378 if (test_server_started_) | 378 if (test_server_started_) |
| 379 return true; | 379 return true; |
| 380 test_server_started_ = test_server()->Start(); | 380 test_server_started_ = test_server()->Start(); |
| 381 return test_server_started_; | 381 return test_server_started_; |
| 382 } | 382 } |
| OLD | NEW |