Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1087)

Unified Diff: device/gamepad/gamepad_service_unittest.cc

Issue 2466073002: Movw GamepadService out of content/browser/ and into device/ (Closed)
Patch Set: Fixed everything but one unittest Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/gamepad/gamepad_service.cc ('k') | device/gamepad/gamepad_shared_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/gamepad/gamepad_service_unittest.cc
diff --git a/content/browser/gamepad/gamepad_service_unittest.cc b/device/gamepad/gamepad_service_unittest.cc
similarity index 87%
rename from content/browser/gamepad/gamepad_service_unittest.cc
rename to device/gamepad/gamepad_service_unittest.cc
index ea5765d3f04cbe08de40a127b4d37686f592df8b..5dc9e4c7d0ad5ca3bb688c09d3883df9636ee56c 100644
--- a/content/browser/gamepad/gamepad_service_unittest.cc
+++ b/device/gamepad/gamepad_service_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/gamepad/gamepad_service.h"
+#include "device/gamepad/gamepad_service.h"
#include <string.h>
@@ -10,12 +10,11 @@
#include "base/macros.h"
#include "base/run_loop.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "device/gamepad/gamepad_consumer.h"
#include "device/gamepad/gamepad_test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace content {
+namespace device {
namespace {
static const int kNumberOfGamepads = blink::WebGamepads::itemsLengthCap;
@@ -25,9 +24,7 @@ using blink::WebGamepads;
class ConnectionListener : public device::GamepadConsumer {
public:
- ConnectionListener() {
- ClearCounters();
- }
+ ConnectionListener() { ClearCounters(); }
void OnGamepadConnected(unsigned index,
const blink::WebGamepad& gamepad) override {
@@ -68,18 +65,19 @@ class GamepadServiceTest : public testing::Test {
void SetUp() override;
+ void TearDown() override { base::RunLoop().RunUntilIdle(); }
+
private:
+ base::MessageLoop message_loop_;
device::MockGamepadDataFetcher* fetcher_;
GamepadService* service_;
std::unique_ptr<ConnectionListener> connection_listener_;
- TestBrowserThreadBundle browser_thread_;
WebGamepads test_data_;
DISALLOW_COPY_AND_ASSIGN(GamepadServiceTest);
};
-GamepadServiceTest::GamepadServiceTest()
- : browser_thread_(TestBrowserThreadBundle::IO_MAINLOOP) {
+GamepadServiceTest::GamepadServiceTest() {
memset(&test_data_, 0, sizeof(test_data_));
// Set it so that we have user gesture.
@@ -94,8 +92,8 @@ GamepadServiceTest::~GamepadServiceTest() {
void GamepadServiceTest::SetUp() {
fetcher_ = new device::MockGamepadDataFetcher(test_data_);
- service_ = new GamepadService(
- std::unique_ptr<device::GamepadDataFetcher>(fetcher_));
+ service_ =
+ new GamepadService(std::unique_ptr<device::GamepadDataFetcher>(fetcher_));
connection_listener_.reset((new ConnectionListener));
service_->SetSanitizationEnabled(false);
service_->ConsumerBecameActive(connection_listener_.get());
@@ -134,4 +132,4 @@ TEST_F(GamepadServiceTest, ConnectionsTest) {
EXPECT_EQ(0, GetDisconnectedCounter());
}
-} // namespace content
+} // namespace device
« no previous file with comments | « device/gamepad/gamepad_service.cc ('k') | device/gamepad/gamepad_shared_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698