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

Side by Side Diff: chrome/browser/prerender/prerender_test_utils.cc

Issue 2321083002: [NoStatePrefetch] Add performance histograms. (Closed)
Patch Set: Review comments Created 4 years, 3 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
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/prerender/prerender_test_utils.h" 5 #include "chrome/browser/prerender/prerender_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/prerender/prerender_manager.h" 8 #include "chrome/browser/prerender/prerender_manager.h"
9 #include "chrome/browser/prerender/prerender_manager_factory.h" 9 #include "chrome/browser/prerender/prerender_manager_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 return GetPrerenderManager()->FindPrerenderData( 442 return GetPrerenderManager()->FindPrerenderData(
443 url, GetSessionStorageNamespace()) != nullptr; 443 url, GetSessionStorageNamespace()) != nullptr;
444 } 444 }
445 445
446 content::WebContents* PrerenderInProcessBrowserTest::GetActiveWebContents() 446 content::WebContents* PrerenderInProcessBrowserTest::GetActiveWebContents()
447 const { 447 const {
448 return current_browser()->tab_strip_model()->GetActiveWebContents(); 448 return current_browser()->tab_strip_model()->GetActiveWebContents();
449 } 449 }
450 450
451 PrerenderManager* PrerenderInProcessBrowserTest::GetPrerenderManager() const { 451 PrerenderManager* PrerenderInProcessBrowserTest::GetPrerenderManager() const {
452 return PrerenderManagerFactory::GetForProfile(current_browser()->profile()); 452 return PrerenderManagerFactory::GetForBrowserContext(
453 current_browser()->profile());
453 } 454 }
454 455
455 TestPrerenderContents* PrerenderInProcessBrowserTest::GetPrerenderContentsFor( 456 TestPrerenderContents* PrerenderInProcessBrowserTest::GetPrerenderContentsFor(
456 const GURL& url) const { 457 const GURL& url) const {
457 PrerenderManager::PrerenderData* prerender_data = 458 PrerenderManager::PrerenderData* prerender_data =
458 GetPrerenderManager()->FindPrerenderData(url, nullptr); 459 GetPrerenderManager()->FindPrerenderData(url, nullptr);
459 return static_cast<TestPrerenderContents*>( 460 return static_cast<TestPrerenderContents*>(
460 prerender_data ? prerender_data->contents() : nullptr); 461 prerender_data ? prerender_data->contents() : nullptr);
461 } 462 }
462 463
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void CreateMockInterceptorOnIO(const GURL& url, const base::FilePath& file) { 538 void CreateMockInterceptorOnIO(const GURL& url, const base::FilePath& file) {
538 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 539 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
539 net::URLRequestFilter::GetInstance()->AddUrlInterceptor( 540 net::URLRequestFilter::GetInstance()->AddUrlInterceptor(
540 url, net::URLRequestMockHTTPJob::CreateInterceptorForSingleFile( 541 url, net::URLRequestMockHTTPJob::CreateInterceptorForSingleFile(
541 file, content::BrowserThread::GetBlockingPool())); 542 file, content::BrowserThread::GetBlockingPool()));
542 } 543 }
543 544
544 } // namespace test_utils 545 } // namespace test_utils
545 546
546 } // namespace prerender 547 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698