diff options
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 7 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 2 | ||||
-rw-r--r-- | chrome/test/testing_browser_process.h | 6 | ||||
-rw-r--r-- | chrome/test/ui/run_all_unittests.cc | 4 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test_suite.h | 23 | ||||
-rw-r--r-- | chrome/test/ui/view_event_test_base.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/view_event_test_base.h | 2 | ||||
-rw-r--r-- | chrome/test/unit/chrome_test_suite.h | 26 | ||||
-rw-r--r-- | chrome/test/unit/run_all_unittests.cc | 5 |
10 files changed, 39 insertions, 40 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index 965d47c..1724f95 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -182,8 +182,11 @@ void AutomationProxy::InitializeChannelID() { } void AutomationProxy::InitializeThread() { - scoped_ptr<Thread> thread(new Thread("AutomationProxy_BackgroundThread")); - bool thread_result = thread->Start(); + scoped_ptr<base::Thread> thread( + new base::Thread("AutomationProxy_BackgroundThread")); + base::Thread::Options options; + options.message_loop_type = MessageLoop::TYPE_IO; + bool thread_result = thread->StartWithOptions(options); DCHECK(thread_result); thread_.swap(thread); } diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 39a0f1c..8491832 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -201,7 +201,7 @@ class AutomationProxy : public IPC::Channel::Listener, void InitializeHandleTracker(); std::wstring channel_id_; - scoped_ptr<Thread> thread_; + scoped_ptr<base::Thread> thread_; scoped_ptr<IPC::ChannelProxy> channel_; scoped_ptr<AutomationHandleTracker> tracker_; diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h index 57c076b..b7255d0 100644 --- a/chrome/test/testing_browser_process.h +++ b/chrome/test/testing_browser_process.h @@ -37,15 +37,15 @@ class TestingBrowserProcess : public BrowserProcess { return NULL; } - virtual Thread* io_thread() { + virtual base::Thread* io_thread() { return NULL; } - virtual Thread* file_thread() { + virtual base::Thread* file_thread() { return NULL; } - virtual Thread* db_thread() { + virtual base::Thread* db_thread() { return NULL; } diff --git a/chrome/test/ui/run_all_unittests.cc b/chrome/test/ui/run_all_unittests.cc index f4c0116..9b7ec72 100644 --- a/chrome/test/ui/run_all_unittests.cc +++ b/chrome/test/ui/run_all_unittests.cc @@ -7,10 +7,6 @@ #include "chrome/test/ui/ui_test_suite.h" int main(int argc, char **argv) { - // Some tests may use base::Singleton<>, thus we need to instanciate - // the AtExitManager or else we will leak objects. - base::AtExitManager at_exit_manager; - PlatformThread::SetName("Tests_Main"); return UITestSuite(argc, argv).Run(); } diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index 847fb20..f7f9257 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -330,6 +330,8 @@ class UITest : public testing::Test { static int timeout_ms_; // Timeout in milliseconds to wait // for an test to finish. ::scoped_ptr<AutomationProxy> server_; + + MessageLoop message_loop_; // Enables PostTask to main thread. }; // These exist only to support the gTest assertion macros, and diff --git a/chrome/test/ui/ui_test_suite.h b/chrome/test/ui/ui_test_suite.h index c60eedb..d15db81 100644 --- a/chrome/test/ui/ui_test_suite.h +++ b/chrome/test/ui/ui_test_suite.h @@ -18,28 +18,29 @@ class UITestSuite : public ChromeTestSuite { virtual void Initialize() { ChromeTestSuite::Initialize(); + CommandLine parsed_command_line; UITest::set_in_process_renderer( - parsed_command_line_.HasSwitch(switches::kSingleProcess)); + parsed_command_line.HasSwitch(switches::kSingleProcess)); UITest::set_in_process_plugins( - parsed_command_line_.HasSwitch(switches::kInProcessPlugins)); + parsed_command_line.HasSwitch(switches::kInProcessPlugins)); UITest::set_no_sandbox( - parsed_command_line_.HasSwitch(switches::kNoSandbox)); + parsed_command_line.HasSwitch(switches::kNoSandbox)); UITest::set_full_memory_dump( - parsed_command_line_.HasSwitch(switches::kFullMemoryCrashReport)); + parsed_command_line.HasSwitch(switches::kFullMemoryCrashReport)); UITest::set_safe_plugins( - parsed_command_line_.HasSwitch(switches::kSafePlugins)); + parsed_command_line.HasSwitch(switches::kSafePlugins)); UITest::set_use_existing_browser( - parsed_command_line_.HasSwitch(UITestSuite::kUseExistingBrowser)); + parsed_command_line.HasSwitch(UITestSuite::kUseExistingBrowser)); UITest::set_dump_histograms_on_exit( - parsed_command_line_.HasSwitch(switches::kDumpHistogramsOnExit)); + parsed_command_line.HasSwitch(switches::kDumpHistogramsOnExit)); UITest::set_enable_dcheck( - parsed_command_line_.HasSwitch(switches::kEnableDCHECK)); + parsed_command_line.HasSwitch(switches::kEnableDCHECK)); UITest::set_silent_dump_on_dcheck( - parsed_command_line_.HasSwitch(switches::kSilentDumpOnDCHECK)); + parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK)); UITest::set_disable_breakpad( - parsed_command_line_.HasSwitch(switches::kDisableBreakpad)); + parsed_command_line.HasSwitch(switches::kDisableBreakpad)); std::wstring test_timeout = - parsed_command_line_.GetSwitchValue(UITestSuite::kTestTimeout); + parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); if (!test_timeout.empty()) { UITest::set_test_timeout_ms(_wtoi(test_timeout.c_str())); } diff --git a/chrome/test/ui/view_event_test_base.cc b/chrome/test/ui/view_event_test_base.cc index edba5dd..a702ea3 100644 --- a/chrome/test/ui/view_event_test_base.cc +++ b/chrome/test/ui/view_event_test_base.cc @@ -93,7 +93,7 @@ gfx::Size ViewEventTestBase::GetPreferredSize() { void ViewEventTestBase::ScheduleMouseMoveInBackground(int x, int y) { if (!dnd_thread_.get()) { - dnd_thread_.reset(new Thread("mouse-move-thread")); + dnd_thread_.reset(new base::Thread("mouse-move-thread")); dnd_thread_->Start(); } dnd_thread_->message_loop()->PostDelayedTask( diff --git a/chrome/test/ui/view_event_test_base.h b/chrome/test/ui/view_event_test_base.h index b4829b3..e89f734 100644 --- a/chrome/test/ui/view_event_test_base.h +++ b/chrome/test/ui/view_event_test_base.h @@ -121,7 +121,7 @@ class ViewEventTestBase : public ChromeViews::WindowDelegate, ChromeViews::View* content_view_; // Thread for posting background MouseMoves. - scoped_ptr<Thread> dnd_thread_; + scoped_ptr<base::Thread> dnd_thread_; DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); }; diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index 5f68e77..9432a03 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -20,17 +20,6 @@ public: ChromeTestSuite(int argc, char** argv) : TestSuite(argc, argv) { } - virtual ~ChromeTestSuite() { - ResourceBundle::CleanupSharedInstance(); - - delete g_browser_process; - g_browser_process = NULL; - - // Tear down shared StatsTable; prevents unit_tests from leaking it. - StatsTable::set_current(NULL); - delete stats_table_; - } - protected: virtual void Initialize() { @@ -44,7 +33,7 @@ protected: // NOTE: The user data directory will be erased before each UI test that // uses it, in order to ensure consistency. std::wstring user_data_dir = - parsed_command_line_.GetSwitchValue(switches::kUserDataDir); + CommandLine().GetSwitchValue(switches::kUserDataDir); if (user_data_dir.empty() && PathService::Get(base::DIR_EXE, &user_data_dir)) file_util::AppendToPath(&user_data_dir, L"test_user_data"); @@ -59,6 +48,19 @@ protected: StatsTable::set_current(stats_table_); } + virtual void Shutdown() { + ResourceBundle::CleanupSharedInstance(); + + delete g_browser_process; + g_browser_process = NULL; + + // Tear down shared StatsTable; prevents unit_tests from leaking it. + StatsTable::set_current(NULL); + delete stats_table_; + + TestSuite::Shutdown(); + } + StatsTable* stats_table_; }; diff --git a/chrome/test/unit/run_all_unittests.cc b/chrome/test/unit/run_all_unittests.cc index 24413d52..8a7419b 100644 --- a/chrome/test/unit/run_all_unittests.cc +++ b/chrome/test/unit/run_all_unittests.cc @@ -2,14 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/at_exit.h" #include "chrome/test/unit/chrome_test_suite.h" int main(int argc, char **argv) { - // Some tests may use base::Singleton<>, thus we need to instanciate - // the AtExitManager or else we will leak objects. - base::AtExitManager at_exit_manager; - return ChromeTestSuite(argc, argv).Run(); } |