| 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/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/browser/ui/webui/web_ui_browsertest.h" | 18 #include "chrome/browser/ui/webui/web_ui_browsertest.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_ui_message_handler.h" | 23 #include "content/public/browser/web_ui_message_handler.h" |
| 24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 25 #include "net/base/address_list.h" | 25 #include "net/base/address_list.h" |
| 26 #include "net/base/host_cache.h" | 26 #include "net/base/host_cache.h" |
| 27 #include "net/base/host_resolver.h" | 27 #include "net/base/host_resolver.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) { | 317 void NetInternalsTest::SetUpCommandLine(CommandLine* command_line) { |
| 318 WebUIBrowserTest::SetUpCommandLine(command_line); | 318 WebUIBrowserTest::SetUpCommandLine(command_line); |
| 319 // Needed to test the prerender view. | 319 // Needed to test the prerender view. |
| 320 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 320 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
| 321 switches::kPrerenderModeSwitchValueEnabled); | 321 switches::kPrerenderModeSwitchValueEnabled); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void NetInternalsTest::SetUpOnMainThread() { | 324 void NetInternalsTest::SetUpOnMainThread() { |
| 325 // Increase the memory allowed in a prerendered page above normal settings, | 325 // Increase the memory allowed in a prerendered page above normal settings, |
| 326 // as debug builds use more memory and often go over the usual limit. | 326 // as debug builds use more memory and often go over the usual limit. |
| 327 Profile* profile = browser()->GetSelectedTabContentsWrapper()->profile(); | 327 Profile* profile = browser()->GetActiveTabContents()->profile(); |
| 328 prerender::PrerenderManager* prerender_manager = | 328 prerender::PrerenderManager* prerender_manager = |
| 329 prerender::PrerenderManagerFactory::GetForProfile(profile); | 329 prerender::PrerenderManagerFactory::GetForProfile(profile); |
| 330 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; | 330 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; |
| 331 } | 331 } |
| 332 | 332 |
| 333 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { | 333 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { |
| 334 return message_handler_.get(); | 334 return message_handler_.get(); |
| 335 } | 335 } |
| 336 | 336 |
| 337 GURL NetInternalsTest::CreatePrerenderLoaderUrl( | 337 GURL NetInternalsTest::CreatePrerenderLoaderUrl( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 350 GURL url_loader = test_server()->GetURL(replacement_path); | 350 GURL url_loader = test_server()->GetURL(replacement_path); |
| 351 return url_loader; | 351 return url_loader; |
| 352 } | 352 } |
| 353 | 353 |
| 354 bool NetInternalsTest::StartTestServer() { | 354 bool NetInternalsTest::StartTestServer() { |
| 355 if (test_server_started_) | 355 if (test_server_started_) |
| 356 return true; | 356 return true; |
| 357 test_server_started_ = test_server()->Start(); | 357 test_server_started_ = test_server()->Start(); |
| 358 return test_server_started_; | 358 return test_server_started_; |
| 359 } | 359 } |
| OLD | NEW |