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

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

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android Created 4 years, 7 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
« no previous file with comments | « media/base/user_input_monitor_mac.cc ('k') | media/base/user_input_monitor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/base/user_input_monitor.h"
6
7 #include <memory>
8
5 #include "base/logging.h" 9 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 11 #include "base/run_loop.h"
9 #include "build/build_config.h" 12 #include "build/build_config.h"
10 #include "media/base/keyboard_event_counter.h" 13 #include "media/base/keyboard_event_counter.h"
11 #include "media/base/user_input_monitor.h"
12 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/skia/include/core/SkPoint.h" 16 #include "third_party/skia/include/core/SkPoint.h"
15 17
16 namespace media { 18 namespace media {
17 19
18 class MockMouseListener : public UserInputMonitor::MouseEventListener { 20 class MockMouseListener : public UserInputMonitor::MouseEventListener {
19 public: 21 public:
20 MOCK_METHOD1(OnMouseMoved, void(const SkIPoint& position)); 22 MOCK_METHOD1(OnMouseMoved, void(const SkIPoint& position));
21 23
(...skipping 24 matching lines...) Expand all
46 #endif // defined(OS_LINUX) || defined(OS_WIN) 48 #endif // defined(OS_LINUX) || defined(OS_WIN)
47 49
48 TEST(UserInputMonitorTest, CreatePlatformSpecific) { 50 TEST(UserInputMonitorTest, CreatePlatformSpecific) {
49 #if defined(OS_LINUX) 51 #if defined(OS_LINUX)
50 base::MessageLoopForIO message_loop; 52 base::MessageLoopForIO message_loop;
51 #else 53 #else
52 base::MessageLoopForUI message_loop; 54 base::MessageLoopForUI message_loop;
53 #endif // defined(OS_LINUX) 55 #endif // defined(OS_LINUX)
54 56
55 base::RunLoop run_loop; 57 base::RunLoop run_loop;
56 scoped_ptr<UserInputMonitor> monitor = UserInputMonitor::Create( 58 std::unique_ptr<UserInputMonitor> monitor = UserInputMonitor::Create(
57 message_loop.task_runner(), message_loop.task_runner()); 59 message_loop.task_runner(), message_loop.task_runner());
58 60
59 if (!monitor) 61 if (!monitor)
60 return; 62 return;
61 63
62 MockMouseListener listener; 64 MockMouseListener listener;
63 // Ignore any callbacks. 65 // Ignore any callbacks.
64 EXPECT_CALL(listener, OnMouseMoved(testing::_)).Times(testing::AnyNumber()); 66 EXPECT_CALL(listener, OnMouseMoved(testing::_)).Times(testing::AnyNumber());
65 67
66 #if !defined(OS_MACOSX) 68 #if !defined(OS_MACOSX)
67 monitor->AddMouseListener(&listener); 69 monitor->AddMouseListener(&listener);
68 monitor->RemoveMouseListener(&listener); 70 monitor->RemoveMouseListener(&listener);
69 #endif // !define(OS_MACOSX) 71 #endif // !define(OS_MACOSX)
70 72
71 monitor->EnableKeyPressMonitoring(); 73 monitor->EnableKeyPressMonitoring();
72 monitor->DisableKeyPressMonitoring(); 74 monitor->DisableKeyPressMonitoring();
73 75
74 monitor.reset(); 76 monitor.reset();
75 run_loop.RunUntilIdle(); 77 run_loop.RunUntilIdle();
76 } 78 }
77 79
78 } // namespace media 80 } // namespace media
OLDNEW
« no previous file with comments | « media/base/user_input_monitor_mac.cc ('k') | media/base/user_input_monitor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698