diff options
author | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 22:28:51 +0000 |
---|---|---|
committer | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-13 22:28:51 +0000 |
commit | 9dc4794d2759fde611f89b6e808a104fe490d7ef (patch) | |
tree | d322b2fcc5843b3f1fcfaeebad4fa974dafc49e6 | |
parent | 3896409bc0f727bd5c41cd3fe7760023757cfd7e (diff) | |
download | chromium_src-9dc4794d2759fde611f89b6e808a104fe490d7ef.zip chromium_src-9dc4794d2759fde611f89b6e808a104fe490d7ef.tar.gz chromium_src-9dc4794d2759fde611f89b6e808a104fe490d7ef.tar.bz2 |
Revert 146670 - Fix unit test to allow repeated successful runs by avoiding a function static variable in tests.
BUG=137145
TEST=run unit_tests with --gtest_filter=ComponentInstallerTest.PepperFlashCheck --gtest_repeat=2 successfully.
Review URL: https://chromiumcodereview.appspot.com/10702188
TBR=scottbyer@chromium.org
Revert reason: checkdeps fail (passed trybots?)
Review URL: https://chromiumcodereview.appspot.com/10788005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146672 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/component_updater/component_installers_unittest.cc (renamed from chrome/browser/component_updater/test/component_installers_unittest.cc) | 5 | ||||
-rw-r--r-- | chrome/browser/component_updater/component_updater_service_unittest.cc (renamed from chrome/browser/component_updater/test/component_updater_service_unittest.cc) | 0 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 5 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_globals.cc | 6 | ||||
-rw-r--r-- | ppapi/shared_impl/ppapi_globals.h | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_module.cc | 2 |
6 files changed, 7 insertions, 14 deletions
diff --git a/chrome/browser/component_updater/test/component_installers_unittest.cc b/chrome/browser/component_updater/component_installers_unittest.cc index e7a4ee1..1b11497 100644 --- a/chrome/browser/component_updater/test/component_installers_unittest.cc +++ b/chrome/browser/component_updater/component_installers_unittest.cc @@ -14,7 +14,6 @@ #include "build/build_config.h" #include "chrome/common/chrome_paths.h" #include "content/public/test/test_browser_thread.h" -#include "ppapi/shared_impl/test_globals.h" #include "testing/gtest/include/gtest/gtest.h" @@ -43,10 +42,6 @@ TEST(ComponentInstallerTest, PepperFlashCheck) { MessageLoop message_loop; content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); - ppapi::PpapiGlobals::ForTest for_test; - ppapi::TestGlobals test_globals(for_test); - ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); - // The test directory is chrome/test/data/components/flapper. FilePath manifest; PathService::Get(chrome::DIR_TEST_DATA, &manifest); diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.cc b/chrome/browser/component_updater/component_updater_service_unittest.cc index 6a25757..6a25757 100644 --- a/chrome/browser/component_updater/test/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/component_updater_service_unittest.cc diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3b56def..0674251 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -951,7 +951,6 @@ '../media/media.gyp:media_test_support', '../net/net.gyp:net', '../net/net.gyp:net_test_support', - '../ppapi/ppapi_internal.gyp:ppapi_unittest_shared', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', 'test_support_common', @@ -1169,8 +1168,8 @@ 'browser/chromeos/version_loader_unittest.cc', 'browser/chromeos/web_socket_proxy_helper_unittest.cc', 'browser/command_updater_unittest.cc', - 'browser/component_updater/test/component_installers_unittest.cc', - 'browser/component_updater/test/component_updater_service_unittest.cc', + 'browser/component_updater/component_installers_unittest.cc', + 'browser/component_updater/component_updater_service_unittest.cc', 'browser/component_updater/component_updater_interceptor.cc', 'browser/component_updater/component_updater_interceptor.h', 'browser/content_settings/content_settings_default_provider_unittest.cc', diff --git a/ppapi/shared_impl/ppapi_globals.cc b/ppapi/shared_impl/ppapi_globals.cc index 0336e0c..80a4ee2 100644 --- a/ppapi/shared_impl/ppapi_globals.cc +++ b/ppapi/shared_impl/ppapi_globals.cc @@ -23,12 +23,10 @@ PpapiGlobals* PpapiGlobals::ppapi_globals_ = NULL; PpapiGlobals::PpapiGlobals() { DCHECK(!ppapi_globals_); ppapi_globals_ = this; - message_loop_proxy_ = base::MessageLoopProxy::current(); } PpapiGlobals::PpapiGlobals(ForTest) { DCHECK(!ppapi_globals_); - message_loop_proxy_ = base::MessageLoopProxy::current(); } PpapiGlobals::~PpapiGlobals() { @@ -45,7 +43,9 @@ void PpapiGlobals::SetPpapiGlobalsOnThreadForTest(PpapiGlobals* ptr) { } base::MessageLoopProxy* PpapiGlobals::GetMainThreadMessageLoop() { - return message_loop_proxy_.get(); + CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::MessageLoopProxy>, proxy, + (base::MessageLoopProxy::current())); + return proxy.get(); } bool PpapiGlobals::IsHostGlobals() const { diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h index e95cf48..00fb9b1 100644 --- a/ppapi/shared_impl/ppapi_globals.h +++ b/ppapi/shared_impl/ppapi_globals.h @@ -8,7 +8,6 @@ #include <string> #include "base/basictypes.h" -#include "base/memory/ref_counted.h" #include "base/threading/thread_local.h" // For testing purposes only. #include "ppapi/c/dev/ppb_console_dev.h" #include "ppapi/c/pp_instance.h" @@ -127,8 +126,6 @@ class PPAPI_SHARED_EXPORT PpapiGlobals { static PpapiGlobals* ppapi_globals_; - scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; - DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); }; diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc index 8d6410e..0efcbf7 100644 --- a/webkit/plugins/ppapi/plugin_module.cc +++ b/webkit/plugins/ppapi/plugin_module.cc @@ -426,6 +426,8 @@ PluginModule::PluginModule(const std::string& name, memset(&entry_points_, 0, sizeof(entry_points_)); pp_module_ = HostGlobals::Get()->AddModule(this); + // Initialize the main thread message loop. + PpapiGlobals::Get()->GetMainThreadMessageLoop(); GetLivePluginSet()->insert(this); } |