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

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: '' 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 602
603 pss_subclass_.reset(new ProcessSingletonSubclass(this)); 603 pss_subclass_.reset(new ProcessSingletonSubclass(this));
604 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_->user_data())); 604 EXPECT_TRUE(pss_subclass_->Subclass(fake_chrome_->user_data()));
605 StartChromeFrameInHostBrowser(); 605 StartChromeFrameInHostBrowser();
606 } 606 }
607 607
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() { 608 void CFUrlRequestUnittestRunner::PreMainMessageLoopRun() {
617 fake_chrome_->InitializePostThreadsCreated();
618 } 609 }
619 610
620 bool CFUrlRequestUnittestRunner::MainMessageLoopRun(int* result_code) { 611 bool CFUrlRequestUnittestRunner::MainMessageLoopRun(int* result_code) {
621 DCHECK(MessageLoop::current()); 612 DCHECK(MessageLoop::current());
622 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); 613 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
623 614
624 // We need to allow IO on the main thread for these tests. 615 // We need to allow IO on the main thread for these tests.
625 base::ThreadRestrictions::SetIOAllowed(true); 616 base::ThreadRestrictions::SetIOAllowed(true);
626 617
627 return false; 618 return false;
628 } 619 }
629 620
630 void CFUrlRequestUnittestRunner::PostMainMessageLoopRun() { 621 void CFUrlRequestUnittestRunner::PostMainMessageLoopRun() {
631 fake_chrome_->browser_process()->StartTearDown(); 622 fake_chrome_->browser_process()->StartTearDown();
632 623
633 // Must do this separately as the mock profile_manager_ is not the 624 // Must do this separately as the mock profile_manager_ is not the
634 // same member as BrowserProcessImpl::StartTearDown resets. 625 // same member as BrowserProcessImpl::StartTearDown resets.
635 fake_chrome_->browser_process()->DestroyProfileManager(); 626 fake_chrome_->browser_process()->DestroyProfileManager();
636 627
637 if (crash_service_) 628 if (crash_service_)
638 base::KillProcess(crash_service_, 0, false); 629 base::KillProcess(crash_service_, 0, false);
639 630
640 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); 631 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL);
641 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); 632 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL);
642 } 633 }
643 634
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() { 635 void CFUrlRequestUnittestRunner::PostDestroyThreads() {
655 fake_chrome_->Shutdown(); 636 fake_chrome_->Shutdown();
656 fake_chrome_.reset(); 637 fake_chrome_.reset();
657 638
658 #ifndef NDEBUG 639 #ifndef NDEBUG
659 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which 640 // 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. 641 // 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. 642 // Webkit global objects are created on the inproc renderer thread.
662 ExitProcess(test_result()); 643 ExitProcess(test_result());
663 #endif 644 #endif
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 // content::InitializeSandboxInfo(&sandbox_info); 728 // content::InitializeSandboxInfo(&sandbox_info);
748 FakeMainDelegate delegate; 729 FakeMainDelegate delegate;
749 content::ContentMain( 730 content::ContentMain(
750 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), 731 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)),
751 &sandbox_info, 732 &sandbox_info,
752 &delegate); 733 &delegate);
753 734
754 // Note: In debug builds, we ExitProcess during PostDestroyThreads. 735 // Note: In debug builds, we ExitProcess during PostDestroyThreads.
755 return g_test_suite->test_result(); 736 return g_test_suite->test_result();
756 } 737 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698