Commit 553f87c9 authored by timvolodine's avatar timvolodine Committed by Commit bot

Bring back lost gamepad_seqlock_unittest.

Currently gamepad_seqlock_unittest.cc is not included in content_tests.gypi.
Also GamepadSeqLock was renamed to OneWriterSeqlLock some time ago as it
is used not only by the gamepad.
To rectify this situation this patch does the following:
- replace references to GamepadSeqLock
- include the unittest in content_tests.gypi

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

Cr-Commit-Position: refs/heads/master@{#292878}
parent 0dbb9968
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/common/gamepad_seqlock.h" #include "content/common/one_writer_seqlock.h"
#include <stdlib.h> #include <stdlib.h>
#include "base/atomic_ref_count.h" #include "base/atomic_ref_count.h"
#include "base/threading/platform_thread.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
...@@ -24,14 +24,14 @@ class BasicSeqLockTestThread : public PlatformThread::Delegate { ...@@ -24,14 +24,14 @@ class BasicSeqLockTestThread : public PlatformThread::Delegate {
BasicSeqLockTestThread() {} BasicSeqLockTestThread() {}
void Init( void Init(
content::GamepadSeqLock* seqlock, content::OneWriterSeqLock* seqlock,
TestData* data, TestData* data,
base::subtle::Atomic32* ready) { base::subtle::Atomic32* ready) {
seqlock_ = seqlock; seqlock_ = seqlock;
data_ = data; data_ = data;
ready_ = ready; ready_ = ready;
} }
virtual void ThreadMain() { virtual void ThreadMain() OVERRIDE {
while (AtomicRefCountIsZero(ready_)) { while (AtomicRefCountIsZero(ready_)) {
PlatformThread::YieldCurrentThread(); PlatformThread::YieldCurrentThread();
} }
...@@ -52,15 +52,15 @@ class BasicSeqLockTestThread : public PlatformThread::Delegate { ...@@ -52,15 +52,15 @@ class BasicSeqLockTestThread : public PlatformThread::Delegate {
} }
private: private:
content::GamepadSeqLock* seqlock_; content::OneWriterSeqLock* seqlock_;
TestData* data_; TestData* data_;
base::AtomicRefCount* ready_; base::AtomicRefCount* ready_;
DISALLOW_COPY_AND_ASSIGN(BasicSeqLockTestThread); DISALLOW_COPY_AND_ASSIGN(BasicSeqLockTestThread);
}; };
TEST(GamepadSeqLockTest, ManyThreads) { TEST(OneWriterSeqLockTest, ManyThreads) {
content::GamepadSeqLock seqlock; content::OneWriterSeqLock seqlock;
TestData data = { 0, 0, 0 }; TestData data = { 0, 0, 0 };
base::AtomicRefCount ready = 0; base::AtomicRefCount ready = 0;
......
...@@ -671,6 +671,7 @@ ...@@ -671,6 +671,7 @@
'common/inter_process_time_ticks_converter_unittest.cc', 'common/inter_process_time_ticks_converter_unittest.cc',
'common/mac/attributed_string_coder_unittest.mm', 'common/mac/attributed_string_coder_unittest.mm',
'common/mac/font_descriptor_unittest.mm', 'common/mac/font_descriptor_unittest.mm',
'common/one_writer_seqlock_unittest.cc',
'common/page_state_serialization_unittest.cc', 'common/page_state_serialization_unittest.cc',
'common/page_zoom_unittest.cc', 'common/page_zoom_unittest.cc',
'common/plugin_list_unittest.cc', 'common/plugin_list_unittest.cc',
......
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