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

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: Add browser tests, fix a bug in what was changed yesterday. 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 prerender_manager->set_on_cookie_store_loaded_cb(
403 base::Bind(
404 &base::MessageLoop::Quit,
405 base::Unretained(base::MessageLoop::current())));
406 base::MessageLoop::current()->Run();
407 }
401 } 408 }
402 409
403 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() { 410 content::WebUIMessageHandler* NetInternalsTest::GetMockMessageHandler() {
404 return message_handler_.get(); 411 return message_handler_.get();
405 } 412 }
406 413
407 GURL NetInternalsTest::CreatePrerenderLoaderUrl( 414 GURL NetInternalsTest::CreatePrerenderLoaderUrl(
408 const GURL& prerender_url) { 415 const GURL& prerender_url) {
409 EXPECT_TRUE(StartTestServer()); 416 EXPECT_TRUE(StartTestServer());
410 std::vector<net::SpawnedTestServer::StringPair> replacement_text; 417 std::vector<net::SpawnedTestServer::StringPair> replacement_text;
411 replacement_text.push_back( 418 replacement_text.push_back(
412 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); 419 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec()));
413 std::string replacement_path; 420 std::string replacement_path;
414 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements( 421 EXPECT_TRUE(net::SpawnedTestServer::GetFilePathWithReplacements(
415 "files/prerender/prerender_loader.html", 422 "files/prerender/prerender_loader.html",
416 replacement_text, 423 replacement_text,
417 &replacement_path)); 424 &replacement_path));
418 GURL url_loader = test_server()->GetURL(replacement_path); 425 GURL url_loader = test_server()->GetURL(replacement_path);
419 return url_loader; 426 return url_loader;
420 } 427 }
421 428
422 bool NetInternalsTest::StartTestServer() { 429 bool NetInternalsTest::StartTestServer() {
423 if (test_server_started_) 430 if (test_server_started_)
424 return true; 431 return true;
425 test_server_started_ = test_server()->Start(); 432 test_server_started_ = test_server()->Start();
426 return test_server_started_; 433 return test_server_started_;
427 } 434 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698