Index: content/browser/gamepad/gamepad_provider_unittest.cc |
diff --git a/content/browser/gamepad/gamepad_provider_unittest.cc b/content/browser/gamepad/gamepad_provider_unittest.cc |
index 00d48c6ad802123fcdea8d41acc5d977bfc11863..619a92a65cb24fcedb502ec76d7ba80d7cf8357e 100644 |
--- a/content/browser/gamepad/gamepad_provider_unittest.cc |
+++ b/content/browser/gamepad/gamepad_provider_unittest.cc |
@@ -64,7 +64,7 @@ TEST_F(GamepadProviderTest, BasicStartStop) { |
} |
// http://crbug.com/105348 |
-TEST_F(GamepadProviderTest, FLAKY_PollingAccess) { |
+TEST_F(GamepadProviderTest, PollingAccess) { |
using namespace gamepad; |
Provider* provider = CreateProvider(); |
@@ -95,22 +95,14 @@ TEST_F(GamepadProviderTest, FLAKY_PollingAccess) { |
GamepadHardwareBuffer* hwbuf = static_cast<GamepadHardwareBuffer*>(mem); |
// See gamepad_hardware_buffer.h for details on the read discipline. |
- base::subtle::Atomic32 start, end; |
WebKit::WebGamepads output; |
- int contention_count; |
- // Here we're attempting to test the read discipline during contention. If |
- // we fail to read this many times, then the read thread is starving, and we |
- // should fail the test. |
- for (contention_count = 0; contention_count < 1000; ++contention_count) { |
- end = base::subtle::Acquire_Load(&hwbuf->end_marker); |
+ base::subtle::Atomic32 version; |
+ do { |
+ version = hwbuf->sequence.ReadBegin(); |
memcpy(&output, &hwbuf->buffer, sizeof(output)); |
- start = base::subtle::Acquire_Load(&hwbuf->start_marker); |
- if (start == end) |
- break; |
- base::PlatformThread::YieldCurrentThread(); |
- } |
- EXPECT_GT(1000, contention_count); |
+ } while (hwbuf->sequence.ReadRetry(version)); |
+ |
EXPECT_EQ(1u, output.length); |
EXPECT_EQ(1u, output.items[0].buttonsLength); |
EXPECT_EQ(1.f, output.items[0].buttons[0]); |