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

Unified Diff: media/base/user_input_monitor_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 side-by-side diff with in-line comments
Download patch
Index: media/base/user_input_monitor_unittest.cc
diff --git a/media/base/user_input_monitor_unittest.cc b/media/base/user_input_monitor_unittest.cc
deleted file mode 100644
index 401d96739079b0e62489092f0e55c43802224e2b..0000000000000000000000000000000000000000
--- a/media/base/user_input_monitor_unittest.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/base/user_input_monitor.h"
-
-#include <memory>
-
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "build/build_config.h"
-#include "media/base/keyboard_event_counter.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkPoint.h"
-
-#if defined(OS_LINUX)
-#include "base/files/file_descriptor_watcher_posix.h"
-#endif
-
-namespace media {
-
-class MockMouseListener : public UserInputMonitor::MouseEventListener {
- public:
- MOCK_METHOD1(OnMouseMoved, void(const SkIPoint& position));
-
- virtual ~MockMouseListener() {}
-};
-
-#if defined(OS_LINUX) || defined(OS_WIN)
-TEST(UserInputMonitorTest, KeyPressCounter) {
- KeyboardEventCounter counter;
-
- EXPECT_EQ(0u, counter.GetKeyPressCount());
-
- counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
- EXPECT_EQ(1u, counter.GetKeyPressCount());
-
- // Holding the same key without releasing it does not increase the count.
- counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
- EXPECT_EQ(1u, counter.GetKeyPressCount());
-
- // Releasing the key does not affect the total count.
- counter.OnKeyboardEvent(ui::ET_KEY_RELEASED, ui::VKEY_0);
- EXPECT_EQ(1u, counter.GetKeyPressCount());
-
- counter.OnKeyboardEvent(ui::ET_KEY_PRESSED, ui::VKEY_0);
- counter.OnKeyboardEvent(ui::ET_KEY_RELEASED, ui::VKEY_0);
- EXPECT_EQ(2u, counter.GetKeyPressCount());
-}
-#endif // defined(OS_LINUX) || defined(OS_WIN)
-
-TEST(UserInputMonitorTest, CreatePlatformSpecific) {
Wez 2017/01/10 02:00:27 Did you mean to remove this test? Doesn't look lik
CJ 2017/01/10 02:35:35 Done.
-#if defined(OS_LINUX)
- base::MessageLoopForIO message_loop;
- base::FileDescriptorWatcher file_descriptor_watcher(&message_loop);
-#else
- base::MessageLoopForUI message_loop;
-#endif // defined(OS_LINUX)
-
- base::RunLoop run_loop;
- std::unique_ptr<UserInputMonitor> monitor = UserInputMonitor::Create(
- message_loop.task_runner(), message_loop.task_runner());
-
- if (!monitor)
- return;
-
- MockMouseListener listener;
- // Ignore any callbacks.
- EXPECT_CALL(listener, OnMouseMoved(testing::_)).Times(testing::AnyNumber());
-
-#if !defined(OS_MACOSX)
- monitor->AddMouseListener(&listener);
- monitor->RemoveMouseListener(&listener);
-#endif // !define(OS_MACOSX)
-
- monitor->EnableKeyPressMonitoring();
- monitor->DisableKeyPressMonitoring();
-
- monitor.reset();
- run_loop.RunUntilIdle();
-}
-
-} // namespace media

Powered by Google App Engine
This is Rietveld 408576698