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 <deque> | 5 #include <deque> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // The prerendered page is then displayed on a tab. The Javascript function | 126 // The prerendered page is then displayed on a tab. The Javascript function |
127 // DidDisplayPass() is called, and returns true if the page behaved as it | 127 // DidDisplayPass() is called, and returns true if the page behaved as it |
128 // should while being displayed. | 128 // should while being displayed. |
129 | 129 |
130 namespace prerender { | 130 namespace prerender { |
131 | 131 |
132 namespace { | 132 namespace { |
133 | 133 |
134 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { | 134 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { |
135 public: | 135 public: |
136 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { | 136 virtual ConnectionType GetCurrentConnectionType() const override { |
137 return NetworkChangeNotifier::CONNECTION_WIFI; | 137 return NetworkChangeNotifier::CONNECTION_WIFI; |
138 } | 138 } |
139 }; | 139 }; |
140 | 140 |
141 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { | 141 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { |
142 public: | 142 public: |
143 virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { | 143 virtual ConnectionType GetCurrentConnectionType() const override { |
144 return NetworkChangeNotifier::CONNECTION_4G; | 144 return NetworkChangeNotifier::CONNECTION_4G; |
145 } | 145 } |
146 }; | 146 }; |
147 | 147 |
148 // Constants used in the test HTML files. | 148 // Constants used in the test HTML files. |
149 const char* kReadyTitle = "READY"; | 149 const char* kReadyTitle = "READY"; |
150 const char* kPassTitle = "PASS"; | 150 const char* kPassTitle = "PASS"; |
151 | 151 |
152 std::string CreateClientRedirect(const std::string& dest_url) { | 152 std::string CreateClientRedirect(const std::string& dest_url) { |
153 const char* const kClientRedirectBase = "client-redirect?"; | 153 const char* const kClientRedirectBase = "client-redirect?"; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 private: | 236 private: |
237 virtual ~DestructionMessageFilter() { | 237 virtual ~DestructionMessageFilter() { |
238 content::BrowserThread::PostTask( | 238 content::BrowserThread::PostTask( |
239 content::BrowserThread::UI, FROM_HERE, | 239 content::BrowserThread::UI, FROM_HERE, |
240 base::Bind(&ChannelDestructionWatcher::OnChannelDestroyed, | 240 base::Bind(&ChannelDestructionWatcher::OnChannelDestroyed, |
241 base::Unretained(watcher_))); | 241 base::Unretained(watcher_))); |
242 } | 242 } |
243 | 243 |
244 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 244 virtual bool OnMessageReceived(const IPC::Message& message) override { |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 ChannelDestructionWatcher* watcher_; | 248 ChannelDestructionWatcher* watcher_; |
249 | 249 |
250 DISALLOW_COPY_AND_ASSIGN(DestructionMessageFilter); | 250 DISALLOW_COPY_AND_ASSIGN(DestructionMessageFilter); |
251 }; | 251 }; |
252 | 252 |
253 void OnChannelDestroyed() { | 253 void OnChannelDestroyed() { |
254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 void set_did_start_loading() { | 305 void set_did_start_loading() { |
306 did_start_loading_ = true; | 306 did_start_loading_ = true; |
307 } | 307 } |
308 | 308 |
309 void Wait() { | 309 void Wait() { |
310 loop_.Run(); | 310 loop_.Run(); |
311 } | 311 } |
312 | 312 |
313 // WebContentsObserver implementation: | 313 // WebContentsObserver implementation: |
314 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE { | 314 virtual void DidStartLoading(RenderViewHost* render_view_host) override { |
315 did_start_loading_ = true; | 315 did_start_loading_ = true; |
316 } | 316 } |
317 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE { | 317 virtual void DidStopLoading(RenderViewHost* render_view_host) override { |
318 if (!did_start_loading_) | 318 if (!did_start_loading_) |
319 return; | 319 return; |
320 number_of_loads_--; | 320 number_of_loads_--; |
321 if (number_of_loads_ == 0) | 321 if (number_of_loads_ == 0) |
322 loop_.Quit(); | 322 loop_.Quit(); |
323 } | 323 } |
324 | 324 |
325 // TabStripModelObserver implementation: | 325 // TabStripModelObserver implementation: |
326 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 326 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
327 WebContents* old_contents, | 327 WebContents* old_contents, |
328 WebContents* new_contents, | 328 WebContents* new_contents, |
329 int index) OVERRIDE { | 329 int index) override { |
330 if (old_contents != web_contents()) | 330 if (old_contents != web_contents()) |
331 return; | 331 return; |
332 // Switch to observing the new WebContents. | 332 // Switch to observing the new WebContents. |
333 Observe(new_contents); | 333 Observe(new_contents); |
334 if (new_contents->IsLoading()) { | 334 if (new_contents->IsLoading()) { |
335 // If the new WebContents is still loading, wait for it to complete. Only | 335 // If the new WebContents is still loading, wait for it to complete. Only |
336 // one load post-swap is supported. | 336 // one load post-swap is supported. |
337 did_start_loading_ = true; | 337 did_start_loading_ = true; |
338 number_of_loads_ = 1; | 338 number_of_loads_ = 1; |
339 } else { | 339 } else { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 // A used PrerenderContents will only be destroyed when we swap out | 427 // A used PrerenderContents will only be destroyed when we swap out |
428 // WebContents, at the end of a navigation caused by a call to | 428 // WebContents, at the end of a navigation caused by a call to |
429 // NavigateToURLImpl(). | 429 // NavigateToURLImpl(). |
430 if (final_status() == FINAL_STATUS_USED) | 430 if (final_status() == FINAL_STATUS_USED) |
431 EXPECT_TRUE(new_render_view_host_); | 431 EXPECT_TRUE(new_render_view_host_); |
432 | 432 |
433 EXPECT_EQ(should_be_shown_, was_shown_); | 433 EXPECT_EQ(should_be_shown_, was_shown_); |
434 } | 434 } |
435 | 435 |
436 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE { | 436 virtual void RenderProcessGone(base::TerminationStatus status) override { |
437 // On quit, it's possible to end up here when render processes are closed | 437 // On quit, it's possible to end up here when render processes are closed |
438 // before the PrerenderManager is destroyed. As a result, it's possible to | 438 // before the PrerenderManager is destroyed. As a result, it's possible to |
439 // get either FINAL_STATUS_APP_TERMINATING or FINAL_STATUS_RENDERER_CRASHED | 439 // get either FINAL_STATUS_APP_TERMINATING or FINAL_STATUS_RENDERER_CRASHED |
440 // on quit. | 440 // on quit. |
441 // | 441 // |
442 // It's also possible for this to be called after we've been notified of | 442 // It's also possible for this to be called after we've been notified of |
443 // app termination, but before we've been deleted, which is why the second | 443 // app termination, but before we've been deleted, which is why the second |
444 // check is needed. | 444 // check is needed. |
445 if (expected_final_status_ == FINAL_STATUS_APP_TERMINATING && | 445 if (expected_final_status_ == FINAL_STATUS_APP_TERMINATING && |
446 final_status() != expected_final_status_) { | 446 final_status() != expected_final_status_) { |
447 expected_final_status_ = FINAL_STATUS_RENDERER_CRASHED; | 447 expected_final_status_ = FINAL_STATUS_RENDERER_CRASHED; |
448 } | 448 } |
449 | 449 |
450 PrerenderContents::RenderProcessGone(status); | 450 PrerenderContents::RenderProcessGone(status); |
451 } | 451 } |
452 | 452 |
453 virtual bool CheckURL(const GURL& url) OVERRIDE { | 453 virtual bool CheckURL(const GURL& url) override { |
454 // Prevent FINAL_STATUS_UNSUPPORTED_SCHEME when navigating to about:crash in | 454 // Prevent FINAL_STATUS_UNSUPPORTED_SCHEME when navigating to about:crash in |
455 // the PrerenderRendererCrash test. | 455 // the PrerenderRendererCrash test. |
456 if (url.spec() != content::kChromeUICrashURL) | 456 if (url.spec() != content::kChromeUICrashURL) |
457 return PrerenderContents::CheckURL(url); | 457 return PrerenderContents::CheckURL(url); |
458 return true; | 458 return true; |
459 } | 459 } |
460 | 460 |
461 // For tests that open the prerender in a new background tab, the RenderView | 461 // For tests that open the prerender in a new background tab, the RenderView |
462 // will not have been made visible when the PrerenderContents is destroyed | 462 // will not have been made visible when the PrerenderContents is destroyed |
463 // even though it is used. | 463 // even though it is used. |
464 void set_should_be_shown(bool value) { should_be_shown_ = value; } | 464 void set_should_be_shown(bool value) { should_be_shown_ = value; } |
465 | 465 |
466 // For tests which do not know whether the prerender will be used. | 466 // For tests which do not know whether the prerender will be used. |
467 void set_skip_final_checks(bool value) { skip_final_checks_ = value; } | 467 void set_skip_final_checks(bool value) { skip_final_checks_ = value; } |
468 | 468 |
469 FinalStatus expected_final_status() const { return expected_final_status_; } | 469 FinalStatus expected_final_status() const { return expected_final_status_; } |
470 | 470 |
471 private: | 471 private: |
472 virtual void OnRenderViewHostCreated( | 472 virtual void OnRenderViewHostCreated( |
473 RenderViewHost* new_render_view_host) OVERRIDE { | 473 RenderViewHost* new_render_view_host) override { |
474 // Used to make sure the RenderViewHost is hidden and, if used, | 474 // Used to make sure the RenderViewHost is hidden and, if used, |
475 // subsequently shown. | 475 // subsequently shown. |
476 notification_registrar().Add( | 476 notification_registrar().Add( |
477 this, | 477 this, |
478 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 478 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
479 content::Source<RenderWidgetHost>(new_render_view_host)); | 479 content::Source<RenderWidgetHost>(new_render_view_host)); |
480 | 480 |
481 new_render_view_host_ = new_render_view_host; | 481 new_render_view_host_ = new_render_view_host; |
482 | 482 |
483 PrerenderContents::OnRenderViewHostCreated(new_render_view_host); | 483 PrerenderContents::OnRenderViewHostCreated(new_render_view_host); |
484 } | 484 } |
485 | 485 |
486 virtual void Observe(int type, | 486 virtual void Observe(int type, |
487 const content::NotificationSource& source, | 487 const content::NotificationSource& source, |
488 const content::NotificationDetails& details) OVERRIDE { | 488 const content::NotificationDetails& details) override { |
489 if (type == | 489 if (type == |
490 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { | 490 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { |
491 EXPECT_EQ(new_render_view_host_, | 491 EXPECT_EQ(new_render_view_host_, |
492 content::Source<RenderWidgetHost>(source).ptr()); | 492 content::Source<RenderWidgetHost>(source).ptr()); |
493 bool is_visible = *content::Details<bool>(details).ptr(); | 493 bool is_visible = *content::Details<bool>(details).ptr(); |
494 | 494 |
495 if (!is_visible) { | 495 if (!is_visible) { |
496 was_hidden_ = true; | 496 was_hidden_ = true; |
497 } else if (is_visible && was_hidden_) { | 497 } else if (is_visible && was_hidden_) { |
498 // Once hidden, a prerendered RenderViewHost should only be shown after | 498 // Once hidden, a prerendered RenderViewHost should only be shown after |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } | 562 } |
563 | 563 |
564 void OnPrerenderCreated(TestPrerenderContents* contents) { | 564 void OnPrerenderCreated(TestPrerenderContents* contents) { |
565 DCHECK(!contents_); | 565 DCHECK(!contents_); |
566 contents_ = contents; | 566 contents_ = contents; |
567 contents_->AddObserver(this); | 567 contents_->AddObserver(this); |
568 create_loop_.Quit(); | 568 create_loop_.Quit(); |
569 } | 569 } |
570 | 570 |
571 // PrerenderContents::Observer implementation: | 571 // PrerenderContents::Observer implementation: |
572 virtual void OnPrerenderStart(PrerenderContents* contents) OVERRIDE { | 572 virtual void OnPrerenderStart(PrerenderContents* contents) override { |
573 start_loop_.Quit(); | 573 start_loop_.Quit(); |
574 } | 574 } |
575 | 575 |
576 virtual void OnPrerenderStopLoading(PrerenderContents* contents) OVERRIDE { | 576 virtual void OnPrerenderStopLoading(PrerenderContents* contents) override { |
577 number_of_loads_++; | 577 number_of_loads_++; |
578 if (load_waiter_ && number_of_loads_ >= expected_number_of_loads_) | 578 if (load_waiter_ && number_of_loads_ >= expected_number_of_loads_) |
579 load_waiter_->Quit(); | 579 load_waiter_->Quit(); |
580 } | 580 } |
581 | 581 |
582 virtual void OnPrerenderStop(PrerenderContents* contents) OVERRIDE { | 582 virtual void OnPrerenderStop(PrerenderContents* contents) override { |
583 DCHECK(contents_); | 583 DCHECK(contents_); |
584 contents_ = NULL; | 584 contents_ = NULL; |
585 stop_loop_.Quit(); | 585 stop_loop_.Quit(); |
586 // If there is a WaitForLoads call and it has yet to see the expected number | 586 // If there is a WaitForLoads call and it has yet to see the expected number |
587 // of loads, stop the loop so the test fails instead of timing out. | 587 // of loads, stop the loop so the test fails instead of timing out. |
588 if (load_waiter_) | 588 if (load_waiter_) |
589 load_waiter_->Quit(); | 589 load_waiter_->Quit(); |
590 } | 590 } |
591 | 591 |
592 virtual void OnPrerenderCreatedMatchCompleteReplacement( | 592 virtual void OnPrerenderCreatedMatchCompleteReplacement( |
593 PrerenderContents* contents, PrerenderContents* replacement) OVERRIDE { | 593 PrerenderContents* contents, PrerenderContents* replacement) override { |
594 } | 594 } |
595 | 595 |
596 private: | 596 private: |
597 TestPrerenderContents* contents_; | 597 TestPrerenderContents* contents_; |
598 int number_of_loads_; | 598 int number_of_loads_; |
599 | 599 |
600 int expected_number_of_loads_; | 600 int expected_number_of_loads_; |
601 scoped_ptr<base::RunLoop> load_waiter_; | 601 scoped_ptr<base::RunLoop> load_waiter_; |
602 | 602 |
603 base::RunLoop create_loop_; | 603 base::RunLoop create_loop_; |
(...skipping 18 matching lines...) Expand all Loading... |
622 ExpectedContents(final_status, handle->AsWeakPtr())); | 622 ExpectedContents(final_status, handle->AsWeakPtr())); |
623 return handle.Pass(); | 623 return handle.Pass(); |
624 } | 624 } |
625 | 625 |
626 virtual PrerenderContents* CreatePrerenderContents( | 626 virtual PrerenderContents* CreatePrerenderContents( |
627 PrerenderManager* prerender_manager, | 627 PrerenderManager* prerender_manager, |
628 Profile* profile, | 628 Profile* profile, |
629 const GURL& url, | 629 const GURL& url, |
630 const content::Referrer& referrer, | 630 const content::Referrer& referrer, |
631 Origin origin, | 631 Origin origin, |
632 uint8 experiment_id) OVERRIDE { | 632 uint8 experiment_id) override { |
633 ExpectedContents expected; | 633 ExpectedContents expected; |
634 if (!expected_contents_queue_.empty()) { | 634 if (!expected_contents_queue_.empty()) { |
635 expected = expected_contents_queue_.front(); | 635 expected = expected_contents_queue_.front(); |
636 expected_contents_queue_.pop_front(); | 636 expected_contents_queue_.pop_front(); |
637 } | 637 } |
638 VLOG(1) << "Creating prerender contents for " << url.path() << | 638 VLOG(1) << "Creating prerender contents for " << url.path() << |
639 " with expected final status " << expected.final_status; | 639 " with expected final status " << expected.final_status; |
640 VLOG(1) << expected_contents_queue_.size() << " left in the queue."; | 640 VLOG(1) << expected_contents_queue_.size() << " left in the queue."; |
641 TestPrerenderContents* contents = | 641 TestPrerenderContents* contents = |
642 new TestPrerenderContents(prerender_manager, | 642 new TestPrerenderContents(prerender_manager, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 // Called on the IO thread to check if the given url is safe or not. If we | 675 // Called on the IO thread to check if the given url is safe or not. If we |
676 // can synchronously determine that the url is safe, CheckUrl returns true. | 676 // can synchronously determine that the url is safe, CheckUrl returns true. |
677 // Otherwise it returns false, and "client" is called asynchronously with the | 677 // Otherwise it returns false, and "client" is called asynchronously with the |
678 // result when it is ready. | 678 // result when it is ready. |
679 // Returns true, indicating a SAFE result, unless the URL is the fixed URL | 679 // Returns true, indicating a SAFE result, unless the URL is the fixed URL |
680 // specified by the user, and the user-specified result is not SAFE | 680 // specified by the user, and the user-specified result is not SAFE |
681 // (in which that result will be communicated back via a call into the | 681 // (in which that result will be communicated back via a call into the |
682 // client, and false will be returned). | 682 // client, and false will be returned). |
683 // Overrides SafeBrowsingService::CheckBrowseUrl. | 683 // Overrides SafeBrowsingService::CheckBrowseUrl. |
684 virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) OVERRIDE { | 684 virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) override { |
685 if (gurl != url_ || threat_type_ == SB_THREAT_TYPE_SAFE) | 685 if (gurl != url_ || threat_type_ == SB_THREAT_TYPE_SAFE) |
686 return true; | 686 return true; |
687 | 687 |
688 BrowserThread::PostTask( | 688 BrowserThread::PostTask( |
689 BrowserThread::IO, FROM_HERE, | 689 BrowserThread::IO, FROM_HERE, |
690 base::Bind(&FakeSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, | 690 base::Bind(&FakeSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, |
691 this, gurl, client)); | 691 this, gurl, client)); |
692 return false; | 692 return false; |
693 } | 693 } |
694 | 694 |
(...skipping 30 matching lines...) Expand all Loading... |
725 | 725 |
726 // Returned pointer has the same lifespan as the database_manager_ refcounted | 726 // Returned pointer has the same lifespan as the database_manager_ refcounted |
727 // object. | 727 // object. |
728 FakeSafeBrowsingDatabaseManager* fake_database_manager() { | 728 FakeSafeBrowsingDatabaseManager* fake_database_manager() { |
729 return fake_database_manager_; | 729 return fake_database_manager_; |
730 } | 730 } |
731 | 731 |
732 protected: | 732 protected: |
733 virtual ~FakeSafeBrowsingService() { } | 733 virtual ~FakeSafeBrowsingService() { } |
734 | 734 |
735 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager() OVERRIDE { | 735 virtual SafeBrowsingDatabaseManager* CreateDatabaseManager() override { |
736 fake_database_manager_ = new FakeSafeBrowsingDatabaseManager(this); | 736 fake_database_manager_ = new FakeSafeBrowsingDatabaseManager(this); |
737 return fake_database_manager_; | 737 return fake_database_manager_; |
738 } | 738 } |
739 | 739 |
740 private: | 740 private: |
741 FakeSafeBrowsingDatabaseManager* fake_database_manager_; | 741 FakeSafeBrowsingDatabaseManager* fake_database_manager_; |
742 | 742 |
743 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingService); | 743 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingService); |
744 }; | 744 }; |
745 | 745 |
746 // Factory that creates FakeSafeBrowsingService instances. | 746 // Factory that creates FakeSafeBrowsingService instances. |
747 class TestSafeBrowsingServiceFactory : public SafeBrowsingServiceFactory { | 747 class TestSafeBrowsingServiceFactory : public SafeBrowsingServiceFactory { |
748 public: | 748 public: |
749 TestSafeBrowsingServiceFactory() : | 749 TestSafeBrowsingServiceFactory() : |
750 most_recent_service_(NULL) { } | 750 most_recent_service_(NULL) { } |
751 virtual ~TestSafeBrowsingServiceFactory() { } | 751 virtual ~TestSafeBrowsingServiceFactory() { } |
752 | 752 |
753 virtual SafeBrowsingService* CreateSafeBrowsingService() OVERRIDE { | 753 virtual SafeBrowsingService* CreateSafeBrowsingService() override { |
754 most_recent_service_ = new FakeSafeBrowsingService(); | 754 most_recent_service_ = new FakeSafeBrowsingService(); |
755 return most_recent_service_; | 755 return most_recent_service_; |
756 } | 756 } |
757 | 757 |
758 FakeSafeBrowsingService* most_recent_service() const { | 758 FakeSafeBrowsingService* most_recent_service() const { |
759 return most_recent_service_; | 759 return most_recent_service_; |
760 } | 760 } |
761 | 761 |
762 private: | 762 private: |
763 FakeSafeBrowsingService* most_recent_service_; | 763 FakeSafeBrowsingService* most_recent_service_; |
764 }; | 764 }; |
765 #endif | 765 #endif |
766 | 766 |
767 class FakeDevToolsClient : public content::DevToolsAgentHostClient { | 767 class FakeDevToolsClient : public content::DevToolsAgentHostClient { |
768 public: | 768 public: |
769 FakeDevToolsClient() {} | 769 FakeDevToolsClient() {} |
770 virtual ~FakeDevToolsClient() {} | 770 virtual ~FakeDevToolsClient() {} |
771 virtual void DispatchProtocolMessage( | 771 virtual void DispatchProtocolMessage( |
772 DevToolsAgentHost* agent_host, const std::string& message) OVERRIDE {} | 772 DevToolsAgentHost* agent_host, const std::string& message) override {} |
773 virtual void AgentHostClosed( | 773 virtual void AgentHostClosed( |
774 DevToolsAgentHost* agent_host, bool replaced) OVERRIDE {} | 774 DevToolsAgentHost* agent_host, bool replaced) override {} |
775 }; | 775 }; |
776 | 776 |
777 class RestorePrerenderMode { | 777 class RestorePrerenderMode { |
778 public: | 778 public: |
779 RestorePrerenderMode() : prev_mode_(PrerenderManager::GetMode()) { | 779 RestorePrerenderMode() : prev_mode_(PrerenderManager::GetMode()) { |
780 } | 780 } |
781 | 781 |
782 ~RestorePrerenderMode() { PrerenderManager::SetMode(prev_mode_); } | 782 ~RestorePrerenderMode() { PrerenderManager::SetMode(prev_mode_); } |
783 private: | 783 private: |
784 PrerenderManager::PrerenderManagerMode prev_mode_; | 784 PrerenderManager::PrerenderManagerMode prev_mode_; |
785 }; | 785 }; |
786 | 786 |
787 // URLRequestJob (and associated handler) which hangs. | 787 // URLRequestJob (and associated handler) which hangs. |
788 class HangingURLRequestJob : public net::URLRequestJob { | 788 class HangingURLRequestJob : public net::URLRequestJob { |
789 public: | 789 public: |
790 HangingURLRequestJob(net::URLRequest* request, | 790 HangingURLRequestJob(net::URLRequest* request, |
791 net::NetworkDelegate* network_delegate) | 791 net::NetworkDelegate* network_delegate) |
792 : net::URLRequestJob(request, network_delegate) { | 792 : net::URLRequestJob(request, network_delegate) { |
793 } | 793 } |
794 | 794 |
795 virtual void Start() OVERRIDE {} | 795 virtual void Start() override {} |
796 | 796 |
797 private: | 797 private: |
798 virtual ~HangingURLRequestJob() {} | 798 virtual ~HangingURLRequestJob() {} |
799 }; | 799 }; |
800 | 800 |
801 class HangingFirstRequestInterceptor : public net::URLRequestInterceptor { | 801 class HangingFirstRequestInterceptor : public net::URLRequestInterceptor { |
802 public: | 802 public: |
803 HangingFirstRequestInterceptor(const base::FilePath& file, | 803 HangingFirstRequestInterceptor(const base::FilePath& file, |
804 base::Closure callback) | 804 base::Closure callback) |
805 : file_(file), | 805 : file_(file), |
806 callback_(callback), | 806 callback_(callback), |
807 first_run_(true) { | 807 first_run_(true) { |
808 } | 808 } |
809 virtual ~HangingFirstRequestInterceptor() {} | 809 virtual ~HangingFirstRequestInterceptor() {} |
810 | 810 |
811 virtual net::URLRequestJob* MaybeInterceptRequest( | 811 virtual net::URLRequestJob* MaybeInterceptRequest( |
812 net::URLRequest* request, | 812 net::URLRequest* request, |
813 net::NetworkDelegate* network_delegate) const OVERRIDE { | 813 net::NetworkDelegate* network_delegate) const override { |
814 if (first_run_) { | 814 if (first_run_) { |
815 first_run_ = false; | 815 first_run_ = false; |
816 if (!callback_.is_null()) { | 816 if (!callback_.is_null()) { |
817 BrowserThread::PostTask( | 817 BrowserThread::PostTask( |
818 BrowserThread::UI, FROM_HERE, callback_); | 818 BrowserThread::UI, FROM_HERE, callback_); |
819 } | 819 } |
820 return new HangingURLRequestJob(request, network_delegate); | 820 return new HangingURLRequestJob(request, network_delegate); |
821 } | 821 } |
822 return new net::URLRequestMockHTTPJob( | 822 return new net::URLRequestMockHTTPJob( |
823 request, | 823 request, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 request, | 855 request, |
856 delegate, | 856 delegate, |
857 file, | 857 file, |
858 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 858 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
859 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)) {} | 859 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)) {} |
860 | 860 |
861 void set_start_callback(const base::Closure& start_callback) { | 861 void set_start_callback(const base::Closure& start_callback) { |
862 start_callback_ = start_callback; | 862 start_callback_ = start_callback; |
863 } | 863 } |
864 | 864 |
865 virtual void Start() OVERRIDE { | 865 virtual void Start() override { |
866 if (!start_callback_.is_null()) | 866 if (!start_callback_.is_null()) |
867 start_callback_.Run(); | 867 start_callback_.Run(); |
868 net::URLRequestMockHTTPJob::Start(); | 868 net::URLRequestMockHTTPJob::Start(); |
869 } | 869 } |
870 | 870 |
871 private: | 871 private: |
872 virtual ~MockHTTPJob() {} | 872 virtual ~MockHTTPJob() {} |
873 | 873 |
874 base::Closure start_callback_; | 874 base::Closure start_callback_; |
875 }; | 875 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 CountingInterceptor(const base::FilePath& file, | 911 CountingInterceptor(const base::FilePath& file, |
912 const base::WeakPtr<RequestCounter>& counter) | 912 const base::WeakPtr<RequestCounter>& counter) |
913 : file_(file), | 913 : file_(file), |
914 counter_(counter), | 914 counter_(counter), |
915 weak_factory_(this) { | 915 weak_factory_(this) { |
916 } | 916 } |
917 virtual ~CountingInterceptor() {} | 917 virtual ~CountingInterceptor() {} |
918 | 918 |
919 virtual net::URLRequestJob* MaybeInterceptRequest( | 919 virtual net::URLRequestJob* MaybeInterceptRequest( |
920 net::URLRequest* request, | 920 net::URLRequest* request, |
921 net::NetworkDelegate* network_delegate) const OVERRIDE { | 921 net::NetworkDelegate* network_delegate) const override { |
922 MockHTTPJob* job = new MockHTTPJob(request, network_delegate, file_); | 922 MockHTTPJob* job = new MockHTTPJob(request, network_delegate, file_); |
923 job->set_start_callback(base::Bind(&CountingInterceptor::RequestStarted, | 923 job->set_start_callback(base::Bind(&CountingInterceptor::RequestStarted, |
924 weak_factory_.GetWeakPtr())); | 924 weak_factory_.GetWeakPtr())); |
925 return job; | 925 return job; |
926 } | 926 } |
927 | 927 |
928 void RequestStarted() { | 928 void RequestStarted() { |
929 BrowserThread::PostTask( | 929 BrowserThread::PostTask( |
930 BrowserThread::UI, FROM_HERE, | 930 BrowserThread::UI, FROM_HERE, |
931 base::Bind(&RequestCounter::RequestStarted, counter_)); | 931 base::Bind(&RequestCounter::RequestStarted, counter_)); |
(...skipping 28 matching lines...) Expand all Loading... |
960 } | 960 } |
961 | 961 |
962 // A ContentBrowserClient that cancels all prerenderers on OpenURL. | 962 // A ContentBrowserClient that cancels all prerenderers on OpenURL. |
963 class TestContentBrowserClient : public chrome::ChromeContentBrowserClient { | 963 class TestContentBrowserClient : public chrome::ChromeContentBrowserClient { |
964 public: | 964 public: |
965 TestContentBrowserClient() {} | 965 TestContentBrowserClient() {} |
966 virtual ~TestContentBrowserClient() {} | 966 virtual ~TestContentBrowserClient() {} |
967 | 967 |
968 // chrome::ChromeContentBrowserClient implementation. | 968 // chrome::ChromeContentBrowserClient implementation. |
969 virtual bool ShouldAllowOpenURL(content::SiteInstance* site_instance, | 969 virtual bool ShouldAllowOpenURL(content::SiteInstance* site_instance, |
970 const GURL& url) OVERRIDE { | 970 const GURL& url) override { |
971 PrerenderManagerFactory::GetForProfile( | 971 PrerenderManagerFactory::GetForProfile( |
972 Profile::FromBrowserContext(site_instance->GetBrowserContext())) | 972 Profile::FromBrowserContext(site_instance->GetBrowserContext())) |
973 ->CancelAllPrerenders(); | 973 ->CancelAllPrerenders(); |
974 return chrome::ChromeContentBrowserClient::ShouldAllowOpenURL(site_instance, | 974 return chrome::ChromeContentBrowserClient::ShouldAllowOpenURL(site_instance, |
975 url); | 975 url); |
976 } | 976 } |
977 | 977 |
978 private: | 978 private: |
979 DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient); | 979 DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient); |
980 }; | 980 }; |
981 | 981 |
982 // A ContentBrowserClient that forces cross-process navigations. | 982 // A ContentBrowserClient that forces cross-process navigations. |
983 class SwapProcessesContentBrowserClient | 983 class SwapProcessesContentBrowserClient |
984 : public chrome::ChromeContentBrowserClient { | 984 : public chrome::ChromeContentBrowserClient { |
985 public: | 985 public: |
986 SwapProcessesContentBrowserClient() {} | 986 SwapProcessesContentBrowserClient() {} |
987 virtual ~SwapProcessesContentBrowserClient() {} | 987 virtual ~SwapProcessesContentBrowserClient() {} |
988 | 988 |
989 // chrome::ChromeContentBrowserClient implementation. | 989 // chrome::ChromeContentBrowserClient implementation. |
990 virtual bool ShouldSwapProcessesForRedirect( | 990 virtual bool ShouldSwapProcessesForRedirect( |
991 content::ResourceContext* resource_context, | 991 content::ResourceContext* resource_context, |
992 const GURL& current_url, | 992 const GURL& current_url, |
993 const GURL& new_url) OVERRIDE { | 993 const GURL& new_url) override { |
994 return true; | 994 return true; |
995 } | 995 } |
996 | 996 |
997 private: | 997 private: |
998 DISALLOW_COPY_AND_ASSIGN(SwapProcessesContentBrowserClient); | 998 DISALLOW_COPY_AND_ASSIGN(SwapProcessesContentBrowserClient); |
999 }; | 999 }; |
1000 | 1000 |
1001 // An ExternalProtocolHandler that blocks everything and asserts it never is | 1001 // An ExternalProtocolHandler that blocks everything and asserts it never is |
1002 // called. | 1002 // called. |
1003 class NeverRunsExternalProtocolHandlerDelegate | 1003 class NeverRunsExternalProtocolHandlerDelegate |
1004 : public ExternalProtocolHandler::Delegate { | 1004 : public ExternalProtocolHandler::Delegate { |
1005 public: | 1005 public: |
1006 // ExternalProtocolHandler::Delegate implementation. | 1006 // ExternalProtocolHandler::Delegate implementation. |
1007 virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( | 1007 virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( |
1008 ShellIntegration::DefaultWebClientObserver* observer, | 1008 ShellIntegration::DefaultWebClientObserver* observer, |
1009 const std::string& protocol) OVERRIDE { | 1009 const std::string& protocol) override { |
1010 NOTREACHED(); | 1010 NOTREACHED(); |
1011 // This will crash, but it shouldn't get this far with BlockState::BLOCK | 1011 // This will crash, but it shouldn't get this far with BlockState::BLOCK |
1012 // anyway. | 1012 // anyway. |
1013 return NULL; | 1013 return NULL; |
1014 } | 1014 } |
1015 virtual ExternalProtocolHandler::BlockState GetBlockState( | 1015 virtual ExternalProtocolHandler::BlockState GetBlockState( |
1016 const std::string& scheme) OVERRIDE { | 1016 const std::string& scheme) override { |
1017 // Block everything and fail the test. | 1017 // Block everything and fail the test. |
1018 ADD_FAILURE(); | 1018 ADD_FAILURE(); |
1019 return ExternalProtocolHandler::BLOCK; | 1019 return ExternalProtocolHandler::BLOCK; |
1020 } | 1020 } |
1021 virtual void BlockRequest() OVERRIDE { } | 1021 virtual void BlockRequest() override { } |
1022 virtual void RunExternalProtocolDialog(const GURL& url, | 1022 virtual void RunExternalProtocolDialog(const GURL& url, |
1023 int render_process_host_id, | 1023 int render_process_host_id, |
1024 int routing_id) OVERRIDE { | 1024 int routing_id) override { |
1025 NOTREACHED(); | 1025 NOTREACHED(); |
1026 } | 1026 } |
1027 virtual void LaunchUrlWithoutSecurityCheck(const GURL& url) OVERRIDE { | 1027 virtual void LaunchUrlWithoutSecurityCheck(const GURL& url) override { |
1028 NOTREACHED(); | 1028 NOTREACHED(); |
1029 } | 1029 } |
1030 virtual void FinishedProcessingCheck() OVERRIDE { | 1030 virtual void FinishedProcessingCheck() override { |
1031 NOTREACHED(); | 1031 NOTREACHED(); |
1032 } | 1032 } |
1033 }; | 1033 }; |
1034 | 1034 |
1035 base::FilePath GetTestPath(const std::string& file_name) { | 1035 base::FilePath GetTestPath(const std::string& file_name) { |
1036 return ui_test_utils::GetTestFilePath( | 1036 return ui_test_utils::GetTestFilePath( |
1037 base::FilePath(FILE_PATH_LITERAL("prerender")), | 1037 base::FilePath(FILE_PATH_LITERAL("prerender")), |
1038 base::FilePath().AppendASCII(file_name)); | 1038 base::FilePath().AppendASCII(file_name)); |
1039 } | 1039 } |
1040 | 1040 |
(...skipping 15 matching lines...) Expand all Loading... |
1056 | 1056 |
1057 virtual ~PrerenderBrowserTest() {} | 1057 virtual ~PrerenderBrowserTest() {} |
1058 | 1058 |
1059 content::SessionStorageNamespace* GetSessionStorageNamespace() const { | 1059 content::SessionStorageNamespace* GetSessionStorageNamespace() const { |
1060 WebContents* web_contents = GetActiveWebContents(); | 1060 WebContents* web_contents = GetActiveWebContents(); |
1061 if (!web_contents) | 1061 if (!web_contents) |
1062 return NULL; | 1062 return NULL; |
1063 return web_contents->GetController().GetDefaultSessionStorageNamespace(); | 1063 return web_contents->GetController().GetDefaultSessionStorageNamespace(); |
1064 } | 1064 } |
1065 | 1065 |
1066 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 1066 virtual void SetUpInProcessBrowserTestFixture() override { |
1067 #if defined(FULL_SAFE_BROWSING) | 1067 #if defined(FULL_SAFE_BROWSING) |
1068 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); | 1068 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); |
1069 #endif | 1069 #endif |
1070 } | 1070 } |
1071 | 1071 |
1072 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 1072 virtual void TearDownInProcessBrowserTestFixture() override { |
1073 #if defined(FULL_SAFE_BROWSING) | 1073 #if defined(FULL_SAFE_BROWSING) |
1074 SafeBrowsingService::RegisterFactory(NULL); | 1074 SafeBrowsingService::RegisterFactory(NULL); |
1075 #endif | 1075 #endif |
1076 } | 1076 } |
1077 | 1077 |
1078 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1078 virtual void SetUpCommandLine(CommandLine* command_line) override { |
1079 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 1079 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
1080 switches::kPrerenderModeSwitchValueEnabled); | 1080 switches::kPrerenderModeSwitchValueEnabled); |
1081 #if defined(OS_MACOSX) | 1081 #if defined(OS_MACOSX) |
1082 // The plugins directory isn't read by default on the Mac, so it needs to be | 1082 // The plugins directory isn't read by default on the Mac, so it needs to be |
1083 // explicitly registered. | 1083 // explicitly registered. |
1084 base::FilePath app_dir; | 1084 base::FilePath app_dir; |
1085 PathService::Get(chrome::DIR_APP, &app_dir); | 1085 PathService::Get(chrome::DIR_APP, &app_dir); |
1086 command_line->AppendSwitchPath( | 1086 command_line->AppendSwitchPath( |
1087 switches::kExtraPluginDir, | 1087 switches::kExtraPluginDir, |
1088 app_dir.Append(FILE_PATH_LITERAL("plugins"))); | 1088 app_dir.Append(FILE_PATH_LITERAL("plugins"))); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 preference_never_network_wifi); | 1157 preference_never_network_wifi); |
1158 } | 1158 } |
1159 { | 1159 { |
1160 scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifier4G); | 1160 scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifier4G); |
1161 EXPECT_EQ( | 1161 EXPECT_EQ( |
1162 ShouldDisableLocalPredictorDueToPreferencesAndNetwork(profile), | 1162 ShouldDisableLocalPredictorDueToPreferencesAndNetwork(profile), |
1163 preference_never_network_4g); | 1163 preference_never_network_4g); |
1164 } | 1164 } |
1165 } | 1165 } |
1166 | 1166 |
1167 virtual void SetUpOnMainThread() OVERRIDE { | 1167 virtual void SetUpOnMainThread() override { |
1168 current_browser()->profile()->GetPrefs()->SetBoolean( | 1168 current_browser()->profile()->GetPrefs()->SetBoolean( |
1169 prefs::kPromptForDownload, false); | 1169 prefs::kPromptForDownload, false); |
1170 IncreasePrerenderMemory(); | 1170 IncreasePrerenderMemory(); |
1171 if (autostart_test_server_) | 1171 if (autostart_test_server_) |
1172 ASSERT_TRUE(test_server()->Start()); | 1172 ASSERT_TRUE(test_server()->Start()); |
1173 ChromeResourceDispatcherHostDelegate:: | 1173 ChromeResourceDispatcherHostDelegate:: |
1174 SetExternalProtocolHandlerDelegateForTesting( | 1174 SetExternalProtocolHandlerDelegateForTesting( |
1175 &external_protocol_handler_delegate_); | 1175 &external_protocol_handler_delegate_); |
1176 | 1176 |
1177 PrerenderManager* prerender_manager = GetPrerenderManager(); | 1177 PrerenderManager* prerender_manager = GetPrerenderManager(); |
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 } | 3015 } |
3016 | 3016 |
3017 class TestClientCertStore : public net::ClientCertStore { | 3017 class TestClientCertStore : public net::ClientCertStore { |
3018 public: | 3018 public: |
3019 TestClientCertStore() {} | 3019 TestClientCertStore() {} |
3020 virtual ~TestClientCertStore() {} | 3020 virtual ~TestClientCertStore() {} |
3021 | 3021 |
3022 // net::ClientCertStore: | 3022 // net::ClientCertStore: |
3023 virtual void GetClientCerts(const net::SSLCertRequestInfo& cert_request_info, | 3023 virtual void GetClientCerts(const net::SSLCertRequestInfo& cert_request_info, |
3024 net::CertificateList* selected_certs, | 3024 net::CertificateList* selected_certs, |
3025 const base::Closure& callback) OVERRIDE { | 3025 const base::Closure& callback) override { |
3026 *selected_certs = net::CertificateList( | 3026 *selected_certs = net::CertificateList( |
3027 1, scoped_refptr<net::X509Certificate>( | 3027 1, scoped_refptr<net::X509Certificate>( |
3028 new net::X509Certificate("test", "test", base::Time(), base::Time()))); | 3028 new net::X509Certificate("test", "test", base::Time(), base::Time()))); |
3029 callback.Run(); | 3029 callback.Run(); |
3030 } | 3030 } |
3031 }; | 3031 }; |
3032 | 3032 |
3033 scoped_ptr<net::ClientCertStore> CreateCertStore() { | 3033 scoped_ptr<net::ClientCertStore> CreateCertStore() { |
3034 return scoped_ptr<net::ClientCertStore>(new TestClientCertStore); | 3034 return scoped_ptr<net::ClientCertStore>(new TestClientCertStore); |
3035 } | 3035 } |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 0); | 3528 0); |
3529 histogram_tester().ExpectTotalCount( | 3529 histogram_tester().ExpectTotalCount( |
3530 "Prerender.websame_PerceivedPLTMatchedComplete", 1); | 3530 "Prerender.websame_PerceivedPLTMatchedComplete", 1); |
3531 } | 3531 } |
3532 | 3532 |
3533 class PrerenderBrowserTestWithNaCl : public PrerenderBrowserTest { | 3533 class PrerenderBrowserTestWithNaCl : public PrerenderBrowserTest { |
3534 public: | 3534 public: |
3535 PrerenderBrowserTestWithNaCl() {} | 3535 PrerenderBrowserTestWithNaCl() {} |
3536 virtual ~PrerenderBrowserTestWithNaCl() {} | 3536 virtual ~PrerenderBrowserTestWithNaCl() {} |
3537 | 3537 |
3538 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 3538 virtual void SetUpCommandLine(CommandLine* command_line) override { |
3539 PrerenderBrowserTest::SetUpCommandLine(command_line); | 3539 PrerenderBrowserTest::SetUpCommandLine(command_line); |
3540 command_line->AppendSwitch(switches::kEnableNaCl); | 3540 command_line->AppendSwitch(switches::kEnableNaCl); |
3541 } | 3541 } |
3542 }; | 3542 }; |
3543 | 3543 |
3544 // Check that NaCl plugins work when enabled, with prerendering. | 3544 // Check that NaCl plugins work when enabled, with prerendering. |
3545 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithNaCl, | 3545 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithNaCl, |
3546 PrerenderNaClPluginEnabled) { | 3546 PrerenderNaClPluginEnabled) { |
3547 #if defined(OS_WIN) && defined(USE_ASH) | 3547 #if defined(OS_WIN) && defined(USE_ASH) |
3548 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 3548 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 // Test interaction of the webNavigation and tabs API with prerender. | 3614 // Test interaction of the webNavigation and tabs API with prerender. |
3615 class PrerenderBrowserTestWithExtensions : public PrerenderBrowserTest, | 3615 class PrerenderBrowserTestWithExtensions : public PrerenderBrowserTest, |
3616 public ExtensionApiTest { | 3616 public ExtensionApiTest { |
3617 public: | 3617 public: |
3618 PrerenderBrowserTestWithExtensions() { | 3618 PrerenderBrowserTestWithExtensions() { |
3619 // The individual tests start the test server through ExtensionApiTest, so | 3619 // The individual tests start the test server through ExtensionApiTest, so |
3620 // the port number can be passed through to the extension. | 3620 // the port number can be passed through to the extension. |
3621 autostart_test_server_ = false; | 3621 autostart_test_server_ = false; |
3622 } | 3622 } |
3623 | 3623 |
3624 virtual void SetUp() OVERRIDE { | 3624 virtual void SetUp() override { |
3625 PrerenderBrowserTest::SetUp(); | 3625 PrerenderBrowserTest::SetUp(); |
3626 } | 3626 } |
3627 | 3627 |
3628 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 3628 virtual void SetUpCommandLine(CommandLine* command_line) override { |
3629 PrerenderBrowserTest::SetUpCommandLine(command_line); | 3629 PrerenderBrowserTest::SetUpCommandLine(command_line); |
3630 ExtensionApiTest::SetUpCommandLine(command_line); | 3630 ExtensionApiTest::SetUpCommandLine(command_line); |
3631 } | 3631 } |
3632 | 3632 |
3633 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 3633 virtual void SetUpInProcessBrowserTestFixture() override { |
3634 PrerenderBrowserTest::SetUpInProcessBrowserTestFixture(); | 3634 PrerenderBrowserTest::SetUpInProcessBrowserTestFixture(); |
3635 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 3635 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
3636 } | 3636 } |
3637 | 3637 |
3638 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 3638 virtual void TearDownInProcessBrowserTestFixture() override { |
3639 PrerenderBrowserTest::TearDownInProcessBrowserTestFixture(); | 3639 PrerenderBrowserTest::TearDownInProcessBrowserTestFixture(); |
3640 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 3640 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
3641 } | 3641 } |
3642 | 3642 |
3643 virtual void SetUpOnMainThread() OVERRIDE { | 3643 virtual void SetUpOnMainThread() override { |
3644 PrerenderBrowserTest::SetUpOnMainThread(); | 3644 PrerenderBrowserTest::SetUpOnMainThread(); |
3645 } | 3645 } |
3646 }; | 3646 }; |
3647 | 3647 |
3648 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, WebNavigation) { | 3648 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTestWithExtensions, WebNavigation) { |
3649 ASSERT_TRUE(StartSpawnedTestServer()); | 3649 ASSERT_TRUE(StartSpawnedTestServer()); |
3650 extensions::FrameNavigationState::set_allow_extension_scheme(true); | 3650 extensions::FrameNavigationState::set_allow_extension_scheme(true); |
3651 | 3651 |
3652 // Wait for the extension to set itself up and return control to us. | 3652 // Wait for the extension to set itself up and return control to us. |
3653 ASSERT_TRUE(RunExtensionTest("webnavigation/prerender")) << message_; | 3653 ASSERT_TRUE(RunExtensionTest("webnavigation/prerender")) << message_; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4409 | 4409 |
4410 // Checks that a prerender which calls window.close() on itself is aborted. | 4410 // Checks that a prerender which calls window.close() on itself is aborted. |
4411 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowClose) { | 4411 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowClose) { |
4412 DisableLoadEventCheck(); | 4412 DisableLoadEventCheck(); |
4413 PrerenderTestURL("files/prerender/prerender_window_close.html", | 4413 PrerenderTestURL("files/prerender/prerender_window_close.html", |
4414 FINAL_STATUS_CLOSED, 0); | 4414 FINAL_STATUS_CLOSED, 0); |
4415 } | 4415 } |
4416 | 4416 |
4417 class PrerenderIncognitoBrowserTest : public PrerenderBrowserTest { | 4417 class PrerenderIncognitoBrowserTest : public PrerenderBrowserTest { |
4418 public: | 4418 public: |
4419 virtual void SetUpOnMainThread() OVERRIDE { | 4419 virtual void SetUpOnMainThread() override { |
4420 Profile* normal_profile = current_browser()->profile(); | 4420 Profile* normal_profile = current_browser()->profile(); |
4421 set_browser(ui_test_utils::OpenURLOffTheRecord( | 4421 set_browser(ui_test_utils::OpenURLOffTheRecord( |
4422 normal_profile, GURL("about:blank"))); | 4422 normal_profile, GURL("about:blank"))); |
4423 PrerenderBrowserTest::SetUpOnMainThread(); | 4423 PrerenderBrowserTest::SetUpOnMainThread(); |
4424 } | 4424 } |
4425 }; | 4425 }; |
4426 | 4426 |
4427 // Checks that prerendering works in incognito mode. | 4427 // Checks that prerendering works in incognito mode. |
4428 IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognito) { | 4428 IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognito) { |
4429 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 4429 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4604 TestShouldDisableLocalPredictorPreferenceNetworkMatrix( | 4604 TestShouldDisableLocalPredictorPreferenceNetworkMatrix( |
4605 true /*preference_wifi_network_wifi*/, | 4605 true /*preference_wifi_network_wifi*/, |
4606 true /*preference_wifi_network_4g*/, | 4606 true /*preference_wifi_network_4g*/, |
4607 true /*preference_always_network_wifi*/, | 4607 true /*preference_always_network_wifi*/, |
4608 false /*preference_always_network_4g*/, | 4608 false /*preference_always_network_4g*/, |
4609 true /*preference_never_network_wifi*/, | 4609 true /*preference_never_network_wifi*/, |
4610 true /*preference_never_network_4g*/); | 4610 true /*preference_never_network_4g*/); |
4611 } | 4611 } |
4612 | 4612 |
4613 } // namespace prerender | 4613 } // namespace prerender |
OLD | NEW |