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

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

Issue 233353003: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync @269781 + 'autlock'->'autolock' from erik's comment that was not included before Created 6 years, 7 months 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 | Annotate | Revision Log
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 "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_util.h" 10 #include "base/file_util.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 void NetInternalsTest::SetUpOnMainThread() { 393 void NetInternalsTest::SetUpOnMainThread() {
394 WebUIBrowserTest::SetUpOnMainThread(); 394 WebUIBrowserTest::SetUpOnMainThread();
395 // Increase the memory allowed in a prerendered page above normal settings, 395 // Increase the memory allowed in a prerendered page above normal settings,
396 // as debug builds use more memory and often go over the usual limit. 396 // as debug builds use more memory and often go over the usual limit.
397 Profile* profile = browser()->profile(); 397 Profile* profile = browser()->profile();
398 prerender::PrerenderManager* prerender_manager = 398 prerender::PrerenderManager* prerender_manager =
399 prerender::PrerenderManagerFactory::GetForProfile(profile); 399 prerender::PrerenderManagerFactory::GetForProfile(profile);
400 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024; 400 prerender_manager->mutable_config().max_bytes = 1000 * 1024 * 1024;
401 if (!prerender_manager->cookie_store_loaded()) {
402 base::RunLoop loop;
403 prerender_manager->set_on_cookie_store_loaded_cb_for_testing(
404 loop.QuitClosure());
405 loop.Run();
406 }
401 } 407 }
402 408
403 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { 409 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() {
404 return message_handler_.get(); 410 return message_handler_.get();
405 } 411 }
406 412
407 GURL NetInternalsTest::CreatePrerenderLoaderUrl( 413 GURL NetInternalsTest::CreatePrerenderLoaderUrl(
408 const GURL& prerender_url) { 414 const GURL& prerender_url) {
409 EXPECT_TRUE(StartTestServer()); 415 EXPECT_TRUE(StartTestServer());
410 std::vector<net::SpawnedTestServer::StringPair> replacement_text; 416 std::vector<net::SpawnedTestServer::StringPair> replacement_text;
411 replacement_text.push_back( 417 replacement_text.push_back(
412 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); 418 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec()));
413 std::string replacement_path; 419 std::string replacement_path;
414 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( 420 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
415 "files/prerender/prerender_loader.html", 421 "files/prerender/prerender_loader.html",
416 replacement_text, 422 replacement_text,
417 &replacement_path)); 423 &replacement_path));
418 GURL url_loader = test_server()->GetURL(replacement_path); 424 GURL url_loader = test_server()->GetURL(replacement_path);
419 return url_loader; 425 return url_loader;
420 } 426 }
421 427
422 bool NetInternalsTest::StartTestServer() { 428 bool NetInternalsTest::StartTestServer() {
423 if (test_server_started_) 429 if (test_server_started_)
424 return true; 430 return true;
425 test_server_started_ = test_server()->Start(); 431 test_server_started_ = test_server()->Start();
426 return test_server_started_; 432 return test_server_started_;
427 } 433 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_search_prerenderer_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698