Commit b00022a5 authored by b.kelemen@samsung.com's avatar b.kelemen@samsung.com

Fix PepperGamepadHostTest.WaitForReply

Fixup after "Gamepad: don't notify about connected pads twice".
The CHECK(!g_gamepad_service) I added is failing because during
unit tests several instance can be created and destroyed.

R=bajones@chromium.org
BUG=391503

Review URL: https://codereview.chromium.org/372053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281959 0039d316-1c4b-4281-b951-d872f2087c98
parent d9f51dad
......@@ -22,23 +22,27 @@ GamepadService* g_gamepad_service = 0;
GamepadService::GamepadService()
: num_active_consumers_(0),
gesture_callback_pending_(false) {
SetInstance();
SetInstance(this);
}
GamepadService::GamepadService(scoped_ptr<GamepadDataFetcher> fetcher)
: provider_(new GamepadProvider(fetcher.Pass())),
num_active_consumers_(0),
gesture_callback_pending_(false) {
SetInstance();
SetInstance(this);
thread_checker_.DetachFromThread();
}
GamepadService::~GamepadService() {
SetInstance(NULL);
}
void GamepadService::SetInstance() {
CHECK(!g_gamepad_service);
g_gamepad_service = this;
void GamepadService::SetInstance(GamepadService* instance) {
// Unit tests can create multiple instances but only one should exist at any
// given time so g_gamepad_service should only go from NULL to non-NULL and
// vica versa.
CHECK(!!instance != !!g_gamepad_service);
g_gamepad_service = instance;
}
GamepadService* GamepadService::GetInstance() {
......
......@@ -92,7 +92,7 @@ class CONTENT_EXPORT GamepadService {
virtual ~GamepadService();
void SetInstance();
static void SetInstance(GamepadService*);
void OnUserGesture();
......
......@@ -5,6 +5,3 @@ CompositingIOSurfaceTransformerTest.*
# False positive, according to crbug.com/386080
WebLayerImplFixedBoundsTest.CompareToWebLayerImplComplex
WebLayerImplFixedBoundsTest.CompareToWebLayerImplSimple
# crbug.com/391503
PepperGamepadHostTest.WaitForReply
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment