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

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

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/gamepad/gamepad_consumer.h" 7 #include "content/browser/gamepad/gamepad_consumer.h"
8 #include "content/browser/gamepad/gamepad_service.h" 8 #include "content/browser/gamepad/gamepad_service.h"
9 #include "content/browser/gamepad/gamepad_test_helpers.h" 9 #include "content/browser/gamepad/gamepad_test_helpers.h"
10 #include "content/public/test/test_browser_thread_bundle.h" 10 #include "content/public/test/test_browser_thread_bundle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 namespace { 15 namespace {
16 static const int kNumberOfGamepads = blink::WebGamepads::itemsLengthCap; 16 static const int kNumberOfGamepads = blink::WebGamepads::itemsLengthCap;
17 } 17 }
18 18
19 using blink::WebGamepads; 19 using blink::WebGamepads;
20 20
21 class ConnectionListener : public GamepadConsumer { 21 class ConnectionListener : public GamepadConsumer {
22 public: 22 public:
23 ConnectionListener() { 23 ConnectionListener() {
24 ClearCounters(); 24 ClearCounters();
25 } 25 }
26 26
27 virtual void OnGamepadConnected( 27 void OnGamepadConnected(unsigned index,
28 unsigned index, 28 const blink::WebGamepad& gamepad) override {
29 const blink::WebGamepad& gamepad) override {
30 connected_counter_++; 29 connected_counter_++;
31 } 30 }
32 virtual void OnGamepadDisconnected( 31 void OnGamepadDisconnected(unsigned index,
33 unsigned index, 32 const blink::WebGamepad& gamepad) override {
34 const blink::WebGamepad& gamepad) override {
35 disconnected_counter_++; 33 disconnected_counter_++;
36 } 34 }
37 35
38 void ClearCounters() { 36 void ClearCounters() {
39 connected_counter_ = 0; 37 connected_counter_ = 0;
40 disconnected_counter_ = 0; 38 disconnected_counter_ = 0;
41 } 39 }
42 40
43 int connected_counter() const { return connected_counter_; } 41 int connected_counter() const { return connected_counter_; }
44 int disconnected_counter() const { return disconnected_counter_; } 42 int disconnected_counter() const { return disconnected_counter_; }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 WaitForData(); 121 WaitForData();
124 EXPECT_EQ(0, GetConnectedCounter()); 122 EXPECT_EQ(0, GetConnectedCounter());
125 EXPECT_EQ(kNumberOfGamepads, GetDisconnectedCounter()); 123 EXPECT_EQ(kNumberOfGamepads, GetDisconnectedCounter());
126 124
127 WaitForData(); 125 WaitForData();
128 EXPECT_EQ(0, GetConnectedCounter()); 126 EXPECT_EQ(0, GetConnectedCounter());
129 EXPECT_EQ(0, GetDisconnectedCounter()); 127 EXPECT_EQ(0, GetDisconnectedCounter());
130 } 128 }
131 129
132 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_provider.h ('k') | content/browser/gamepad/gamepad_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698