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

Side by Side Diff: content/browser/gamepad/gamepad_service_unittest.cc

Issue 2129003002: Refactored gamepad polling to support dynamic sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test issue and Mac XBoxDataFetcher constructor Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gamepad/gamepad_service.h" 5 #include "content/browser/gamepad/gamepad_service.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 GamepadServiceTest::~GamepadServiceTest() { 91 GamepadServiceTest::~GamepadServiceTest() {
92 delete service_; 92 delete service_;
93 } 93 }
94 94
95 void GamepadServiceTest::SetUp() { 95 void GamepadServiceTest::SetUp() {
96 fetcher_ = new device::MockGamepadDataFetcher(test_data_); 96 fetcher_ = new device::MockGamepadDataFetcher(test_data_);
97 service_ = new GamepadService( 97 service_ = new GamepadService(
98 std::unique_ptr<device::GamepadDataFetcher>(fetcher_)); 98 std::unique_ptr<device::GamepadDataFetcher>(fetcher_));
99 connection_listener_.reset((new ConnectionListener)); 99 connection_listener_.reset((new ConnectionListener));
100 service_->SetSanitizationEnabled(false);
100 service_->ConsumerBecameActive(connection_listener_.get()); 101 service_->ConsumerBecameActive(connection_listener_.get());
101 } 102 }
102 103
103 void GamepadServiceTest::SetPadsConnected(bool connected) { 104 void GamepadServiceTest::SetPadsConnected(bool connected) {
104 for (int i = 0; i < kNumberOfGamepads; ++i) { 105 for (int i = 0; i < kNumberOfGamepads; ++i) {
105 test_data_.items[i].connected = connected; 106 test_data_.items[i].connected = connected;
106 } 107 }
107 fetcher_->SetTestData(test_data_); 108 fetcher_->SetTestData(test_data_);
108 } 109 }
109 110
(...skipping 17 matching lines...) Expand all
127 WaitForData(); 128 WaitForData();
128 EXPECT_EQ(0, GetConnectedCounter()); 129 EXPECT_EQ(0, GetConnectedCounter());
129 EXPECT_EQ(kNumberOfGamepads, GetDisconnectedCounter()); 130 EXPECT_EQ(kNumberOfGamepads, GetDisconnectedCounter());
130 131
131 WaitForData(); 132 WaitForData();
132 EXPECT_EQ(0, GetConnectedCounter()); 133 EXPECT_EQ(0, GetConnectedCounter());
133 EXPECT_EQ(0, GetDisconnectedCounter()); 134 EXPECT_EQ(0, GetDisconnectedCounter());
134 } 135 }
135 136
136 } // namespace content 137 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698