diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 21:21:05 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 21:21:05 +0000 |
commit | b5fa7fdbad352f5679cc772afd923f74d34456a1 (patch) | |
tree | 140c83a39b4fe70625e767e97623dd5281053e5a /chrome_frame/test | |
parent | fc1926184af3507865502a92b5102e12680b7c21 (diff) | |
download | chromium_src-b5fa7fdbad352f5679cc772afd923f74d34456a1.zip chromium_src-b5fa7fdbad352f5679cc772afd923f74d34456a1.tar.gz chromium_src-b5fa7fdbad352f5679cc772afd923f74d34456a1.tar.bz2 |
Ensure that the AtExitManager instance is initialized before the renderer client is initialized in the
ChromeFrame net test suite. This addresses DCHECKs which fire in debug builds making it hard for debugging
test failures.
This CL also ensures that we don't register the browser local state preference twice thus causing dchecks
to fire in debug builds of the chrome frame net test suite.
Other changes include the following:-
1. Turn off the metrics service preference for chrome frame net tests and always return
NULL when asked for the metrics service instance in our implementation of the BrowserProcess
interface
2. Initialize the test timeouts which addresses DCHECKs in debug builds.
With these changes in chrome frame net tests now run in debug builds which should make it easier for
debugging failures.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=87074
BUG=87074
Review URL: http://codereview.chromium.org/7247014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.cc | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 40bee36..2344296 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -15,6 +15,7 @@ #include "base/file_util.h" #include "base/file_version_info.h" #include "base/i18n/icu_util.h" +#include "base/lazy_instance.h" #include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/string_util.h" @@ -117,10 +118,25 @@ class FakeBrowserProcessImpl : public BrowserProcessImpl { return profile_manager_.get(); } + virtual MetricsService* metrics_service() { + return NULL; + } + private: scoped_ptr<ProfileManager> profile_manager_; }; +base::LazyInstance<chrome::ChromeContentClient> + g_chrome_content_client(base::LINKER_INITIALIZED); + +// Override the default ContentBrowserClient to let Chrome participate in +// content logic. Must be done before any tabs are created. +base::LazyInstance<chrome::ChromeContentBrowserClient> + g_browser_client(base::LINKER_INITIALIZED); + +base::LazyInstance<chrome::ChromeContentRendererClient> + g_renderer_client(base::LINKER_INITIALIZED); + } // namespace @@ -212,6 +228,7 @@ void FakeExternalTab::Initialize() { base::SystemMonitor system_monitor; icu_util::Initialize(); + TestTimeouts::Initialize(); app::RegisterPathProvider(); content::RegisterPathProvider(); @@ -238,12 +255,24 @@ void FakeExternalTab::Initialize() { g_browser_process->SetApplicationLocale("en-US"); RenderProcessHost::set_run_renderer_in_process(true); - browser::RegisterLocalState(browser_process_->local_state()); + + browser_process_->local_state()->RegisterBooleanPref( + prefs::kMetricsReportingEnabled, false); FilePath profile_path(ProfileManager::GetDefaultProfileDir(user_data())); Profile* profile = g_browser_process->profile_manager()->GetProfile(profile_path); + + // Initialize the content client which that code uses to talk to Chrome. + content::SetContentClient(&g_chrome_content_client.Get()); + + // Override the default ContentBrowserClient to let Chrome participate in + // content logic. Must be done before any tabs are created. + content::GetContentClient()->set_browser(&g_browser_client.Get()); + + content::GetContentClient()->set_renderer(&g_renderer_client.Get()); + // Create the child threads. g_browser_process->db_thread(); g_browser_process->file_thread(); @@ -522,18 +551,6 @@ int main(int argc, char** argv) { return 0; } - // Initialize the content client which that code uses to talk to Chrome. - chrome::ChromeContentClient chrome_content_client; - content::SetContentClient(&chrome_content_client); - - // Override the default ContentBrowserClient to let Chrome participate in - // content logic. Must be done before any tabs are created. - chrome::ChromeContentBrowserClient browser_client; - content::GetContentClient()->set_browser(&browser_client); - - chrome::ChromeContentRendererClient renderer_client; - content::GetContentClient()->set_renderer(&renderer_client); - // TODO(tommi): Stuff be broke. Needs a fixin'. // This is awkward: the TestSuite derived CFUrlRequestUnittestRunner contains // the instance of the AtExitManager that RegisterPathProvider() and others |