Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc

Issue 2537503002: [Prerender] Get the prerender mode from Finch field trial. (Closed)
Patch Set: cleanup Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/values.h" 19 #include "base/values.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/io_thread.h" 21 #include "chrome/browser/io_thread.h"
22 #include "chrome/browser/prerender/prerender_manager.h" 22 #include "chrome/browser/prerender/prerender_manager.h"
23 #include "chrome/browser/prerender/prerender_manager_factory.h" 23 #include "chrome/browser/prerender/prerender_manager_factory.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" 26 #include "chrome/browser/ui/tabs/tab_strip_model.h"
27 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" 27 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
28 #include "chrome/common/channel_info.h" 28 #include "chrome/common/channel_info.h"
29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
31 #include "chrome/test/base/ui_test_utils.h" 30 #include "chrome/test/base/ui_test_utils.h"
32 #include "components/net_log/chrome_net_log.h" 31 #include "components/net_log/chrome_net_log.h"
33 #include "components/prefs/pref_service.h" 32 #include "components/prefs/pref_service.h"
34 #include "content/public/browser/render_frame_host.h" 33 #include "content/public/browser/render_frame_host.h"
35 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
36 #include "content/public/browser/web_ui_message_handler.h" 35 #include "content/public/browser/web_ui_message_handler.h"
37 #include "net/base/address_list.h" 36 #include "net/base/address_list.h"
38 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
39 #include "net/dns/host_cache.h" 38 #include "net/dns/host_cache.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 //////////////////////////////////////////////////////////////////////////////// 322 ////////////////////////////////////////////////////////////////////////////////
324 323
325 NetInternalsTest::NetInternalsTest() 324 NetInternalsTest::NetInternalsTest()
326 : test_server_started_(false) { 325 : test_server_started_(false) {
327 message_handler_.reset(new MessageHandler(this)); 326 message_handler_.reset(new MessageHandler(this));
328 } 327 }
329 328
330 NetInternalsTest::~NetInternalsTest() { 329 NetInternalsTest::~NetInternalsTest() {
331 } 330 }
332 331
333 void NetInternalsTest::SetUpCommandLine(base::CommandLine* command_line) {
334 WebUIBrowserTest::SetUpCommandLine(command_line);
335 // Needed to test the prerender view.
336 command_line->AppendSwitchASCII(switches::kPrerenderMode,
337 switches::kPrerenderModeSwitchValueEnabled);
338 }
339
340 void NetInternalsTest::SetUpOnMainThread() { 332 void NetInternalsTest::SetUpOnMainThread() {
341 WebUIBrowserTest::SetUpOnMainThread(); 333 WebUIBrowserTest::SetUpOnMainThread();
334 // Needed to test the prerender view.
335 prerender::PrerenderManager::SetMode(
336 prerender::PrerenderManager::PRERENDER_MODE_ENABLED);
342 // Increase the memory allowed in a prerendered page above normal settings, 337 // Increase the memory allowed in a prerendered page above normal settings,
343 // as debug builds use more memory and often go over the usual limit. 338 // as debug builds use more memory and often go over the usual limit.
344 Profile* profile = browser()->profile(); 339 Profile* profile = browser()->profile();
345 prerender::PrerenderManager* prerender_manager = 340 prerender::PrerenderManager* prerender_manager =
346 prerender::PrerenderManagerFactory::GetForBrowserContext(profile); 341 prerender::PrerenderManagerFactory::GetForBrowserContext(profile);
347 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; 342 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024;
348 } 343 }
349 344
350 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { 345 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() {
351 return message_handler_.get(); 346 return message_handler_.get();
(...skipping 16 matching lines...) Expand all
368 if (test_server_started_) 363 if (test_server_started_)
369 return true; 364 return true;
370 test_server_started_ = embedded_test_server()->Start(); 365 test_server_started_ = embedded_test_server()->Start();
371 366
372 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1 367 // Sample domain for SDCH-view test. Dictionaries for localhost/127.0.0.1
373 // are forbidden. 368 // are forbidden.
374 host_resolver()->AddRule("testdomain.com", "127.0.0.1"); 369 host_resolver()->AddRule("testdomain.com", "127.0.0.1");
375 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1"); 370 host_resolver()->AddRule("sub.testdomain.com", "127.0.0.1");
376 return test_server_started_; 371 return test_server_started_;
377 } 372 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698