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

Side by Side Diff: chrome_frame/test/net/fake_external_tab.cc

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix chromeos ui_tests Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_frame/test/net/fake_external_tab.h" 5 #include "chrome_frame/test/net/fake_external_tab.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <exdisp.h> 9 #include <exdisp.h>
10 10
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 593
594 void CFUrlRequestUnittestRunner::PreEarlyInitialization() { 594 void CFUrlRequestUnittestRunner::PreEarlyInitialization() {
595 testing::InitGoogleTest(&g_argc, g_argv); 595 testing::InitGoogleTest(&g_argc, g_argv);
596 FilterDisabledTests(); 596 FilterDisabledTests();
597 } 597 }
598 598
599 void CFUrlRequestUnittestRunner::PreCreateThreads() { 599 void CFUrlRequestUnittestRunner::PreCreateThreads() {
600 fake_chrome_.reset(new FakeExternalTab()); 600 fake_chrome_.reset(new FakeExternalTab());
601 fake_chrome_->Initialize(); 601 fake_chrome_->Initialize();
602 fake_chrome_->browser_process()->PreCreateThreads();
602 603
603 pss_subclass_.reset(new ProcessSingletonSubclass(this)); 604 pss_subclass_.reset(new ProcessSingletonSubclass(this));
604 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_->user_data())); 605 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_->user_data()));
605 StartChromeFrameInHostBrowser(); 606 StartChromeFrameInHostBrowser();
606 } 607 }
607 608
608 void CFUrlRequestUnittestRunner::PreStartThread(BrowserThread::ID identifier) {
609 fake_chrome_->browser_process()->PreStartThread(identifier);
610 }
611
612 void CFUrlRequestUnittestRunner::PostStartThread(BrowserThread::ID identifier) {
613 fake_chrome_->browser_process()->PostStartThread(identifier);
614 }
615
616 void CFUrlRequestUnittestRunner::PreMainMessageLoopRun() { 609 void CFUrlRequestUnittestRunner::PreMainMessageLoopRun() {
617 fake_chrome_->InitializePostThreadsCreated(); 610 fake_chrome_->InitializePostThreadsCreated();
618 } 611 }
619 612
620 bool CFUrlRequestUnittestRunner::MainMessageLoopRun(int* result_code) { 613 bool CFUrlRequestUnittestRunner::MainMessageLoopRun(int* result_code) {
621 DCHECK(MessageLoop::current()); 614 DCHECK(MessageLoop::current());
622 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); 615 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
623 616
624 // We need to allow IO on the main thread for these tests. 617 // We need to allow IO on the main thread for these tests.
625 base::ThreadRestrictions::SetIOAllowed(true); 618 base::ThreadRestrictions::SetIOAllowed(true);
626 619
627 return false; 620 return false;
628 } 621 }
629 622
630 void CFUrlRequestUnittestRunner::PostMainMessageLoopRun() { 623 void CFUrlRequestUnittestRunner::PostMainMessageLoopRun() {
631 fake_chrome_->browser_process()->StartTearDown(); 624 fake_chrome_->browser_process()->StartTearDown();
632 625
633 // Must do this separately as the mock profile_manager_ is not the 626 // Must do this separately as the mock profile_manager_ is not the
634 // same member as BrowserProcessImpl::StartTearDown resets. 627 // same member as BrowserProcessImpl::StartTearDown resets.
635 fake_chrome_->browser_process()->DestroyProfileManager(); 628 fake_chrome_->browser_process()->DestroyProfileManager();
636 629
637 if (crash_service_) 630 if (crash_service_)
638 base::KillProcess(crash_service_, 0, false); 631 base::KillProcess(crash_service_, 0, false);
639 632
640 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); 633 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL);
641 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); 634 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL);
642 } 635 }
643 636
644 void CFUrlRequestUnittestRunner::PreStopThread(
645 content::BrowserThread::ID identifier) {
646 fake_chrome_->browser_process()->PreStopThread(identifier);
647 }
648
649 void CFUrlRequestUnittestRunner::PostStopThread(
650 content::BrowserThread::ID identifier) {
651 fake_chrome_->browser_process()->PostStopThread(identifier);
652 }
653
654 void CFUrlRequestUnittestRunner::PostDestroyThreads() { 637 void CFUrlRequestUnittestRunner::PostDestroyThreads() {
638 fake_chrome_->browser_process()->PostDestroyThreads();
655 fake_chrome_->Shutdown(); 639 fake_chrome_->Shutdown();
656 fake_chrome_.reset(); 640 fake_chrome_.reset();
657 641
658 #ifndef NDEBUG 642 #ifndef NDEBUG
659 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which 643 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which
660 // check if globals are created and destroyed on the same thread don't fire. 644 // check if globals are created and destroyed on the same thread don't fire.
661 // Webkit global objects are created on the inproc renderer thread. 645 // Webkit global objects are created on the inproc renderer thread.
662 ExitProcess(test_result()); 646 ExitProcess(test_result());
663 #endif 647 #endif
664 } 648 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 // content::InitializeSandboxInfo(&sandbox_info); 731 // content::InitializeSandboxInfo(&sandbox_info);
748 FakeMainDelegate delegate; 732 FakeMainDelegate delegate;
749 content::ContentMain( 733 content::ContentMain(
750 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), 734 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)),
751 &sandbox_info, 735 &sandbox_info,
752 &delegate); 736 &delegate);
753 737
754 // Note: In debug builds, we ExitProcess during PostDestroyThreads. 738 // Note: In debug builds, we ExitProcess during PostDestroyThreads.
755 return g_test_suite->test_result(); 739 return g_test_suite->test_result();
756 } 740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698