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

Side by Side Diff: ash/virtual_keyboard_controller_unittest.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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 | « ash/utility/partial_screenshot_controller.h ('k') | ash/wm/app_list_controller_unittest.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 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 "ash/virtual_keyboard_controller.h" 5 #include "ash/virtual_keyboard_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) { 41 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) {
42 ui::DeviceHotplugEventObserver* manager = 42 ui::DeviceHotplugEventObserver* manager =
43 ui::DeviceDataManager::GetInstance(); 43 ui::DeviceDataManager::GetInstance();
44 manager->OnKeyboardDevicesUpdated(keyboard_devices); 44 manager->OnKeyboardDevicesUpdated(keyboard_devices);
45 } 45 }
46 46
47 // Sets the event blocker on the maximized window controller. 47 // Sets the event blocker on the maximized window controller.
48 void SetEventBlocker( 48 void SetEventBlocker(
49 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) { 49 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) {
50 Shell::GetInstance()->maximize_mode_controller()->event_blocker_ = 50 Shell::GetInstance()->maximize_mode_controller()->event_blocker_ =
51 std::move(blocker); 51 std::move(blocker);
52 } 52 }
53 53
54 void SetUp() override { 54 void SetUp() override {
55 base::CommandLine::ForCurrentProcess()->AppendSwitch( 55 base::CommandLine::ForCurrentProcess()->AppendSwitch(
56 keyboard::switches::kDisableSmartVirtualKeyboard); 56 keyboard::switches::kDisableSmartVirtualKeyboard);
57 AshTestBase::SetUp(); 57 AshTestBase::SetUp();
58 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); 58 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
59 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); 59 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 DISALLOW_COPY_AND_ASSIGN(MockEventBlocker); 95 DISALLOW_COPY_AND_ASSIGN(MockEventBlocker);
96 }; 96 };
97 97
98 // Tests that reenabling keyboard devices while shutting down does not 98 // Tests that reenabling keyboard devices while shutting down does not
99 // cause the Virtual Keyboard Controller to crash. See crbug.com/446204. 99 // cause the Virtual Keyboard Controller to crash. See crbug.com/446204.
100 TEST_F(VirtualKeyboardControllerTest, RestoreKeyboardDevices) { 100 TEST_F(VirtualKeyboardControllerTest, RestoreKeyboardDevices) {
101 // Toggle maximized mode on. 101 // Toggle maximized mode on.
102 Shell::GetInstance() 102 Shell::GetInstance()
103 ->maximize_mode_controller() 103 ->maximize_mode_controller()
104 ->EnableMaximizeModeWindowManager(true); 104 ->EnableMaximizeModeWindowManager(true);
105 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker( 105 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> blocker(
106 new MockEventBlocker); 106 new MockEventBlocker);
107 SetEventBlocker(std::move(blocker)); 107 SetEventBlocker(std::move(blocker));
108 } 108 }
109 109
110 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, 110 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
111 public VirtualKeyboardObserver { 111 public VirtualKeyboardObserver {
112 public: 112 public:
113 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} 113 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {}
114 ~VirtualKeyboardControllerAutoTest() override {} 114 ~VirtualKeyboardControllerAutoTest() override {}
115 115
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 UpdateTouchscreenDevices(screens); 340 UpdateTouchscreenDevices(screens);
341 std::vector<ui::KeyboardDevice> keyboards; 341 std::vector<ui::KeyboardDevice> keyboards;
342 keyboards.push_back(ui::KeyboardDevice( 342 keyboards.push_back(ui::KeyboardDevice(
343 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); 343 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
344 UpdateKeyboardDevices(keyboards); 344 UpdateKeyboardDevices(keyboards);
345 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); 345 ASSERT_TRUE(keyboard::IsKeyboardEnabled());
346 } 346 }
347 347
348 } // namespace test 348 } // namespace test
349 } // namespace ash 349 } // namespace ash
OLDNEW
« no previous file with comments | « ash/utility/partial_screenshot_controller.h ('k') | ash/wm/app_list_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698