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

Side by Side Diff: media/base/keyboard_event_counter_unittest.cc

Issue 2577573002: Removes mouse listeners from UserInputMonitor. (Closed)
Patch Set: Updates win's Start/Stop Monitor. Created 3 years, 11 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/base/keyboard_event_counter.h"
6
7 #include <memory>
8
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h"
12 #include "build/build_config.h"
13 #include "media/base/keyboard_event_counter.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/skia/include/core/SkPoint.h"
17
18 namespace media {
19
20 TEST(KeyboardEventCounterTest, KeyPressCounter) {
21 KeyboardEventCounter counter;
22
23 EXPECT_EQ(0u, counter.GetKeyPressCount());
24
25 counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
26 EXPECT_EQ(1u, counter.GetKeyPressCount());
27
28 // Holding the same key without releasing it does not increase the count.
29 counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
30 EXPECT_EQ(1u, counter.GetKeyPressCount());
31
32 // Releasing the key does not affect the total count.
33 counter.OnKeyboardEvent(ui::ET_KEY_RELEASED, ui::VKEY_0);
34 EXPECT_EQ(1u, counter.GetKeyPressCount());
35
36 counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
37 counter.OnKeyboardEvent(ui::ET_KEY_RELEASED, ui::VKEY_0);
38 EXPECT_EQ(2u, counter.GetKeyPressCount());
39 }
40
41 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698